-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
DEPR: datetimelike.astype(int) #38544
Changes from 3 commits
6a23a3c
93d8b25
a40e61a
4b029b5
420b36c
166eb3a
64bcb83
373fc4f
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 |
---|---|---|
|
@@ -37,7 +37,8 @@ def test_astype_conversion(self): | |
) | ||
tm.assert_index_equal(result, expected) | ||
|
||
result = idx.astype(np.int64) | ||
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): | ||
result = idx.astype(np.int64) | ||
expected = Int64Index( | ||
[16937] + [-9223372036854775808] * 3, dtype=np.int64, name="idx" | ||
) | ||
|
@@ -48,15 +49,17 @@ def test_astype_conversion(self): | |
tm.assert_index_equal(result, expected) | ||
|
||
idx = period_range("1990", "2009", freq="A", name="idx") | ||
result = idx.astype("i8") | ||
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): | ||
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. for a lot of these you can just change the test if you want to use view 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. changed one of these, the rest were specifically targeting astype and not worth mucking with |
||
result = idx.astype("i8") | ||
tm.assert_index_equal(result, Index(idx.asi8, name="idx")) | ||
tm.assert_numpy_array_equal(result.values, idx.asi8) | ||
|
||
def test_astype_uint(self): | ||
arr = period_range("2000", periods=2, name="idx") | ||
expected = UInt64Index(np.array([10957, 10958], dtype="uint64"), name="idx") | ||
tm.assert_index_equal(arr.astype("uint64"), expected) | ||
tm.assert_index_equal(arr.astype("uint32"), expected) | ||
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): | ||
tm.assert_index_equal(arr.astype("uint64"), expected) | ||
tm.assert_index_equal(arr.astype("uint32"), expected) | ||
|
||
def test_astype_object(self): | ||
idx = PeriodIndex([], freq="M") | ||
|
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.
casting -> astype
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.
will update
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.
updated+green