-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Prevent OutOfBoundsDatetime error for constructing tz-aware series from list #54620
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 4 commits
b04455f
9a54182
263f1f2
68857be
e4da3f7
12f330b
0390045
4527313
0e7e883
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
PeriodArray, | ||
TimedeltaArray, | ||
) | ||
from pandas.core.arrays.datetimes import _sequence_to_dt64ns | ||
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. we no longer test this function directly |
||
from pandas.core.arrays.datetimes import _sequence_to_dt64 | ||
from pandas.core.arrays.timedeltas import sequence_to_td64ns | ||
|
||
|
||
|
@@ -1313,7 +1313,7 @@ def test_from_pandas_array(dtype): | |
expected = cls._from_sequence(data) | ||
tm.assert_extension_array_equal(result, expected) | ||
|
||
func = {"M8[ns]": _sequence_to_dt64ns, "m8[ns]": sequence_to_td64ns}[dtype] | ||
func = {"M8[ns]": _sequence_to_dt64, "m8[ns]": sequence_to_td64ns}[dtype] | ||
result = func(arr)[0] | ||
expected = func(data)[0] | ||
tm.assert_equal(result, expected) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1148,6 +1148,15 @@ def test_constructor_with_datetime_tz(self): | |
result = DatetimeIndex(s, freq="infer") | ||
tm.assert_index_equal(result, dr) | ||
|
||
def test_constructor_with_datetime_tz_ms(self): | ||
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 will also fix .astype to non-nano. can you add a test for that |
||
# explicit frequency | ||
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.
|
||
result = Series([Timestamp("2999-01-01")], dtype="datetime64[ms, US/Pacific]") | ||
expected = Series( | ||
np.array(["2999-01-01"], dtype="datetime64[ms]") | ||
).dt.tz_localize("US/Pacific") | ||
tm.assert_series_equal(result, expected) | ||
assert result.dtype == "datetime64[ms, US/Pacific]" | ||
|
||
def test_constructor_with_datetime_tz4(self): | ||
# inference | ||
s = Series( | ||
|
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.
"specified otherwise" -> "specified otherwise by
out_unit
"