Skip to content

Conversation

@mroeschke
Copy link
Member

This method appeared under tested so added some additional tests for numeric and object Index

@mroeschke mroeschke added this to the 1.2 milestone Aug 22, 2020
@mroeschke mroeschke added Bug Datetime Datetime data dtype labels Aug 22, 2020
@mroeschke mroeschke mentioned this pull request Aug 22, 2020
32 tasks
@@ -0,0 +1,76 @@
from datetime import date, datetime
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 this should go in tests.indexes.datetimes.test_indexing

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 am also testing object and numeric Indexes in this file as well. Where should those tests go?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id put the object ones in tests.indexes.base_class.test_indexing.TestGetSliceBounds and the numeric ones in tests.indexes.numeric.test_indexing.TestGetSliceBounds

if self._is_strictly_monotonic_decreasing and len(self) > 1:
return upper if side == "left" else lower
return lower if side == "left" else upper
# GH 35690: Ensure the label matches the timezone of the index's tz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll comment in #35690, not entirely sure this is the desired behavior.

Assuming it is the desired behavior, can this casting take place in _maybe_cast_for_get_loc? If not, can you update the docstring to reflect this change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure yeah this can probably go in _maybe_cast_for_get_loc

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will look soon

# needed to localize naive datetimes
# needed to localize naive datetimes or dates (GH 35690)
if isinstance(key, date) and not isinstance(key, datetime):
key = datetime.combine(key, time(0, 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't the Timestamp(key) below do this already?

@jbrockmendel
Copy link
Member

Just commented on #35690, the upshot of which is that I think the current behavior is correct.

)

if kind not in ("loc", "getitem", None):
raise ValueError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be an AssertionError as this is an internal method (yes I know @RhysU is actually calling it), but its officially public and merely an interface from .loc

@pep8speaks
Copy link

pep8speaks commented Aug 25, 2020

Hello @mroeschke! 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 2020-09-02 05:43:44 UTC

@jreback
Copy link
Contributor

jreback commented Sep 2, 2020

lgtm @mroeschke

ideally we also test via .loc[] for these behaviors (we likey have some already tested); but as a followup is fine.

@jreback jreback merged commit 76f74d5 into pandas-dev:master Sep 2, 2020
@jbrockmendel
Copy link
Member

See comment above, this PR should not be merged.

kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
@mroeschke mroeschke deleted the bug/get_slice_bounds branch November 12, 2020 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Datetime Datetime data dtype

Projects

None yet

5 participants