-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: loc returning wrong elements for non-monotonic DatetimeIndex #38010
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
Conversation
have to look at this in detail |
� Conflicts: � doc/source/whatsnew/v1.2.0.rst
@@ -1552,6 +1552,40 @@ def test_loc_getitem_str_timedeltaindex(self): | |||
sliced = df.loc["0 days"] | |||
tm.assert_series_equal(sliced, expected) | |||
|
|||
@pytest.mark.parametrize("indexer_end", [None, "2020-01-02 23:59:59.999999999"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need/want tzaware case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need them, since we are indexing with strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i meant for the index to be tzaware
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thx. Is this the right fixture?
pandas/tests/indexing/test_loc.py
Outdated
self, indexer_end, frame_or_series | ||
): | ||
# GH#33146 | ||
df = frame_or_series( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you call this obj
instead of df
(which is generally DataFrame-specific)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Was before parametrization probably
pandas/tests/indexing/test_loc.py
Outdated
# GH#33146 | ||
df = frame_or_series( | ||
[1] * 5, | ||
index=pd.Index( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Index is in the namespace, shouldnt need pd.Index (in fact the linter should be complaining about it IIUC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it for all Index calls
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
thanks @phofl very nice. |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
That one was tricky. When only one existing key was given or both string parts exist,
Index.slice_indexer
is not raising KeyError but selecting a lof of erroneous values