-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fix regression for is_monotonic_increasing with nan in MultiIndex #37221
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
Changes from 2 commits
e77ba11
e2cd2eb
d6dfe5c
339ae88
c3d1ab6
c7b95ab
31ef0b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,3 +174,9 @@ def test_is_strictly_monotonic_decreasing(): | |
) | ||
assert idx.is_monotonic_decreasing is True | ||
assert idx._is_strictly_monotonic_decreasing is False | ||
|
||
|
||
def test_is_monotonic_with_nans(): | ||
# GH: 37220 | ||
idx = pd.MultiIndex.from_tuples([(np.nan,), (1,)], names=["test"]) | ||
assert idx.is_monotonic_increasing is False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe parametrize over different positions for [ins] In [32]: idx
Out[32]: Float64Index([nan, 1.0, 2.0], dtype='float64')
[ins] In [33]: idx.sort_values(ascending=True).is_monotonic_increasing
Out[33]: False There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That really is interesting. With 0.25.3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think probably fine to call it a regression fix. I would say the previous behavior is not correct in this case (if monotone increasing means There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks very much for the explanation. Adjusted the code accordingly.
phofl marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.