-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
BUG: Remove special-casing for date objects in DatetimeIndex indexing (GH#62158) #62198
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
Open
Aniketsy
wants to merge
10
commits into
pandas-dev:main
Choose a base branch
from
Aniketsy:fix-datetime-indexing-62158-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+34
−20
Open
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
761ac0e
DOC: Clarify list-like vs scalar in Series.eq docstring
Aniketsy 29662c0
Merge branch 'main' of https://github.com/pandas-dev/pandas
Aniketsy 2f98bd4
BUG: Remove special-casing for date objects in DatetimeIndex indexing…
Aniketsy 69ae807
BUG: Remove special-casing for date objects in DatetimeIndex indexing…
Aniketsy 7441046
Revert unintended changes in datetimes.py and test_asfreq.py
Aniketsy 149b9c4
Revert unintended changes in datetimes.py and test_asfreq.py
Aniketsy 6c8b76a
Remove unintended changes in pandas/core/indexes/datetimes.py
Aniketsy 0a0f582
API: Remove implicit matching of datetime.date with DatetimeIndex/Tim…
Aniketsy 30a87b4
API: Remove implicit matching of datetime.date with DatetimeIndex/Tim…
Aniketsy f8e4974
API: Remove implicit matching of datetime.date with DatetimeIndex/Tim…
Aniketsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1880,6 +1880,17 @@ def test_add_new_column_infer_string(): | |
tm.assert_frame_equal(df, expected) | ||
|
||
|
||
def test_datetime_indexer_consistency_pyarrow_date32(): | ||
# GH#62158 | ||
ser = Series(["2016-01-01"], dtype="date32[pyarrow]") | ||
ser3 = ser.astype("datetime64[ns]") | ||
dti = Index(ser3) | ||
# All should be consistent | ||
assert dti.get_loc(ser[0]) == 0 | ||
tm.assert_numpy_array_equal(dti.get_indexer(ser.values), [0]) | ||
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. the second arg here should be an array, not list |
||
tm.assert_numpy_array_equal(dti.get_indexer(ser.values.astype(object)), [0]) | ||
|
||
|
||
class TestSetitemValidation: | ||
# This is adapted from pandas/tests/arrays/masked/test_indexing.py | ||
def _check_setitem_invalid(self, df, invalid, indexer): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,7 +190,7 @@ def test_asfreq_with_date_object_index(self, frame_or_series): | |
ts = frame_or_series(np.random.default_rng(2).standard_normal(20), index=rng) | ||
|
||
ts2 = ts.copy() | ||
ts2.index = [x.date() for x in ts2.index] | ||
ts2.index = to_datetime([x.date() for x in ts2.index]) | ||
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 this defeats the purpose of this test |
||
|
||
result = ts2.asfreq("4h", method="ffill") | ||
expected = ts.asfreq("4h", method="ffill") | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 dont think this is part of the original issue?
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.
Thank you for the feedback. I have removed the unrelated parts of this issue, and I will look into it further as the checks are still failing.