-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Do not use string Index like Datetimelike Index #33531
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -408,3 +408,20 @@ def test_isocalendar_returns_correct_values_close_to_new_year_with_tz(): | |
dtype="UInt32", | ||
) | ||
tm.assert_frame_equal(result, expected_data_frame) | ||
|
||
|
||
def test_datetimelike_string(): | ||
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. ideally could paramaterize this with things that don't match here (e.g. more than just 1 thing). Also this is not in the right location, search for were we test .equals 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 will move this in pandas/tests/indexes/datetimes/test_ops.py By trying to parametrize I have now more question about the expected behaviors, see comment that follows. |
||
# Related to PR 32739 | ||
# Ensure we do not compare strings and datetimelike type. | ||
date_string = "2020-04-13" | ||
i1 = pd.Index([date_string]) | ||
i2 = pd.Index([pd.to_datetime(date_string)]) | ||
|
||
assert i1.equals(i2) is False | ||
assert i2.equals(i1) is False | ||
|
||
assert len(i1.intersection(i2)) == 0 | ||
assert len(i2.intersection(i1)) == 0 | ||
|
||
assert len(i1.union(i2)) == 2 | ||
assert len(i2.union(i1)) == 2 |
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.
why is this added?
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.
My bad I failed my rebase, this is old code I missed.