Skip to content

REF: avoid maybe_convert_platform #41709

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

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from pandas.compat.numpy import function as nv
from pandas.util._decorators import Appender

from pandas.core.dtypes.cast import maybe_convert_platform
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_datetime64_dtype,
Expand Down Expand Up @@ -1650,4 +1649,6 @@ def _maybe_convert_platform_interval(values) -> ArrayLike:
else:
values = extract_array(values, extract_numpy=True)

return maybe_convert_platform(values)
if not hasattr(values, "dtype"):
return np.asarray(values)
return values
3 changes: 0 additions & 3 deletions pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,6 @@ def _prep_ndarray(values, copy: bool = True) -> np.ndarray:
def convert(v):
if not is_list_like(v) or isinstance(v, ABCDataFrame):
return v
elif not hasattr(v, "dtype") and not isinstance(v, (list, tuple, range)):
# TODO: should we cast these to list?
return v

v = extract_array(v, extract_numpy=True)
res = maybe_convert_platform(v)
Expand Down