Skip to content

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

Open
@ClaireDons

Description

@ClaireDons

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugOutput-Formatting__repr__ of pandas objects, to_stringRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions