question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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()

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, Jul 17, 2022

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.
0reactions
mroeschkecommented, Aug 20, 2022

This has been reverted in https://github.com/pandas-dev/pandas/pull/48116, and the discussion to change closed to inclusive can be discussed in https://github.com/pandas-dev/pandas/issues/40245 so closing in favor of that issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas.Interval — pandas 1.5.2 documentation
Immutable object implementing an Interval, a bounded slice-like interval. Parameters. leftorderable scalar. Left bound for the interval. rightorderable scalar.
Read more >
How to change right-bounded interval into left ... - Stack Overflow
I use Interval from pandas. My main interval: main_interval = pd.Interval(left=0, right=1, closed='left ...
Read more >
Package 'RMark' - Microsoft R Application Network
By default, the bins are open on the left and closed on the right (i.e., ... can be modified by changing the argument...
Read more >
Python for Data Analysis - Free
Run the installer and accept the default installation location ... and EuroPython are the two main general Python conferences in the United States...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found