Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,6 @@ def astype_nansafe(arr, dtype, copy=True):
----------
arr : ndarray
dtype : np.dtype
copy : bool or None, default True
Whether to copy during the `.astype` (True) or
just return a view (False). Passing `copy=None` will
attempt to return a view, but will copy if necessary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the copy keyword still exists, so I would not remove it completely

"""

# dispatch on extension dtype if needed
Expand Down Expand Up @@ -745,15 +741,7 @@ def astype_nansafe(arr, dtype, copy=True):

if copy:
return arr.astype(dtype, copy=True)
else:
try:
return arr.view(dtype)
except TypeError:
if copy is None:
# allowed to copy if necessary (e.g. object)
return arr.astype(dtype, copy=True)
else:
raise
return arr.view(dtype)


def maybe_convert_objects(values, convert_dates=True, convert_numeric=True,
Expand Down