pandas: BUG: default for pd.Interval of closed/inclusive changed on main from right to both

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

print(pd.__version__)
i = pd.Interval(pd.Timestamp("2020-01-01"), pd.Timestamp("2020-01-02"))
print(repr(i))
print(i)

1.4.2
Interval('2020-01-01', '2020-01-02', closed='right')
(2020-01-01, 2020-01-02]

1.5.0.dev0+958.gf7be58a477
Interval('2020-01-01', '2020-01-02', inclusive='both')
[2020-01-01, 2020-01-02]

Issue Description

This isn’t mentioned in the release notes. We should decide on how to proceed.

Expected Behavior

cc @simonjayhawkins

Installed Versions

Replace this line with the output of pd.show_versions()

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

Should we maybe reconsider the actual deprecation of closed to start with (instead of fixing some issues caused by the deprecation)?

I understand the strive for consistency in keyword arguments (and that certainly makes sense for things like highlight_between, between and between_time that those are consistent with each other), but specifically for the Interval-related methods, we already were consistently using the “closed” terminology. In addition:

  • “closed” is standard terminology for intervals (and more than “inclusive” I think, or at least the rename is not fixing some unclear naming)
  • It’s not just a keyword argument rename, but also several attributes and methods on several classes that need to be renamed (eg set_closed should then also be deprecated/renamed?)
  • Reading a parquet or pickle file written with a previous version of pandas no longer works (this can certainly be fixed, but is additional overhead that the deprecation causes)
  • The other methods (highlight_between, between and between_time) are not related to the Interval data type, so I think consistency between those methods and interval-related methods is less important as consistency within both groups.