Skip to content

Commit 5615b9f

Browse files
committed
pass copy kwarg
1 parent f271005 commit 5615b9f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pandas/core/arrays/datetimelike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def astype(self, dtype, copy=True):
431431
elif is_categorical_dtype(dtype):
432432
return Categorical(self, dtype=dtype)
433433
else:
434-
return np.asarray(self, dtype=dtype)
434+
return np.asarray(self, dtype=dtype, copy=copy)
435435

436436
def view(self, dtype=None):
437437
"""

pandas/tests/arrays/test_period.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def test_astype_copies():
109109

110110
result = arr.astype(np.int64, copy=True)
111111
assert result is not arr._data
112+
tm.assert_numpy_array_equal(result, arr._data.view('i8'))
112113

113114

114115
def test_astype_categorical():

0 commit comments

Comments
 (0)