Feature Type

  • [ ] Adding new functionality to pandas

  • [X] Changing existing functionality in pandas

  • [ ] Removing existing functionality in pandas

Problem Description

pd.Interval behaviour change from #55035 means that hour, minute and second components is always shown regardless of if timezone is included as an argument. The default behaviour until now has been for time to be dropped if 00:00:00. In our use-case this broke some tests and does not provide useful information.

  -    anchor_year  i_interval                  interval   data  is_target
    -0          2019          -1  [2019-07-04, 2019-12-31)   14.5      False
    -1          2019           1  [2019-12-31, 2020-06-28)  119.5       True
    -2          2020          -1  [2020-07-04, 2020-12-31)  305.5      False
    -3          2020           1  [2020-12-31, 2021-06-29)  485.5       True
    +   anchor_year  i_interval                                    interval   data  is_target
    +0         2019          -1  [2019-07-04 00:00:00, 2019-12-31 00:00:00)   14.5      False
    +1         2019           1  [2019-12-31 00:00:00, 2020-06-28 00:00:00)  119.5       True
    +2         2020          -1  [2020-07-04 00:00:00, 2020-12-31 00:00:00)  305.5      False
    +3         2020           1  [2020-12-31 00:00:00, 2021-06-29 00:00:00)  485.5       True

Feature Description

It would be nice to revert to dropping hour, minute and second components when 00:00:00 and when no timezone is specified.

Alternative Solutions

N/A

Additional Context

No response

Comment From: BSchilperoort

To add to this: @ClaireDons is advocating for reverting to the previous behavior (pre-2.2.0).

In cases where only dates matter and all the data is timezone naive, adding the hours, minutes and seconds to the __repr__ of the pd.Timestamp adds a lot of visual clutter.

This change was not warned for, nor discussed or reviewed in #55035 and #55015, but came as a byproduct of showing the timezone offset.

Comment From: rhshadrach

cc @mroeschke