Skip to content

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 22, 2020

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

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Nov 26, 2020
@jreback
Copy link
Contributor

jreback commented Nov 26, 2020

have to look at this in detail

@pep8speaks
Copy link

pep8speaks commented Nov 30, 2020

Hello @phofl! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-01-03 21:51:10 UTC

@@ -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"])
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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

Copy link
Member Author

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?

self, indexer_end, frame_or_series
):
# GH#33146
df = frame_or_series(
Copy link
Member

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)

Copy link
Member Author

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

# GH#33146
df = frame_or_series(
[1] * 5,
index=pd.Index(
Copy link
Member

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)

Copy link
Member Author

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

@jreback jreback added this to the 1.3 milestone Jan 4, 2021
@jreback jreback merged commit bbffcb9 into pandas-dev:master Jan 5, 2021
@jreback
Copy link
Contributor

jreback commented Jan 5, 2021

thanks @phofl very nice.

@phofl phofl deleted the 33146 branch January 5, 2021 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in slicing by datetime January 1, 2020
4 participants