Skip to content

Conversation

Aniketsy
Copy link
Contributor

This PR resolves (GH#62158) by removing the legacy special-casing for Python date objects in DatetimeIndex indexing logic.

What’s Changed:
Removed the special-case handling of date objects in DatetimeIndex.getitem.

Updated/added tests in pandas/tests/frame/indexing/test_indexing.py to reflect the new, consistent behavior.

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !

@Aniketsy
Copy link
Contributor Author

@jbrockmendel hi
Could you please review my PR for the datetime/date indexing deprecation?

I have a question about handling the new deprecation warning
Do I need to add @pytest.mark.filterwarnings("ignore:Indexing/slicing with datetime.date is deprecated") to every individual test that triggers this warning, or is there a preferred way to handle this globally for the test suite?
Also should I update every test that uses the deprecated behavior, or is there a more efficient approach?

Thanks!

@jbrockmendel
Copy link
Member

Mostly looks good, will need a whatsnew note

@Aniketsy
Copy link
Contributor Author

@jbrockmendel Thanks for the feedback! I’ve applied the suggested changes and updated the PR. Please let me know if there’s anything else that needs adjustment.

@jbrockmendel
Copy link
Member

Can you get the CI passing?

@Aniketsy
Copy link
Contributor Author

Sure, I’ll look into the CI failures.

@Aniketsy
Copy link
Contributor Author

Hi @jbrockmendel , I’ve identified that one of the CI failures is due to the pyarrow import error, which I’ve skipped. However, I’m still having trouble understanding the cause of the other three failed tests. Could you help me take a look?

@jbrockmendel
Copy link
Member

test_align_date_objects_with_datetimeindex involves alignment that will change when dates no longer match to datetimes

@Aniketsy
Copy link
Contributor Author

@jbrockmendel Thanks for the help! I’ve updated the changes, but CI is still failing. I’ll look into this in more detail.

@Aniketsy Aniketsy force-pushed the fix-datetime-indexing-62158-clean branch from 256908c to 1c59ae7 Compare October 1, 2025 05:35
@jbrockmendel
Copy link
Member

@Aniketsy whats the word here?

@Aniketsy
Copy link
Contributor Author

@jbrockmendel i’m stuck- getting 3 check fails, i tried to fix them but haven't been successful. Could you please take a look and guide me on this?

@jbrockmendel
Copy link
Member

The test_align_date_objects_with_datetimeindex ones look like the behavior is correct and the test expected needs to be updated (with comment about the history and whatsnew note about the change).

The pyarrow one looks like you need to add a check to exclude pa.types.is_date in a place where it is implicitly (incorrectly) assuming that dtype.kind =="M" \Rightarrow pa.types.is_timestap

@Aniketsy
Copy link
Contributor Author

@jbrockmendel still getting CI check fails, there are 3 test failure. I've updated as per suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants