Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: No longer always show hour, minute and second components for pd.Interval #57748

Open
1 of 3 tasks
ClaireDons opened this issue Mar 6, 2024 · 2 comments
Open
1 of 3 tasks
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@ClaireDons
Copy link

Feature Type

  • Adding new functionality to pandas

  • 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

@ClaireDons ClaireDons added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 6, 2024
@BSchilperoort
Copy link

BSchilperoort commented Mar 6, 2024

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.

@rhshadrach
Copy link
Member

cc @mroeschke

@rhshadrach rhshadrach added the Regression Functionality that used to work in a prior pandas version label Mar 7, 2024
@rhshadrach rhshadrach added this to the 2.2.2 milestone Mar 7, 2024
@lithomas1 lithomas1 added Bug Output-Formatting __repr__ of pandas objects, to_string and removed Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 22, 2024
@lithomas1 lithomas1 modified the milestones: 2.2.2, 2.2.3 Apr 10, 2024
@lithomas1 lithomas1 modified the milestones: 2.2.3, 2.3 Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Output-Formatting __repr__ of pandas objects, to_string Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

No branches or pull requests

4 participants