Skip to content

Commit

Permalink
_infer_dtype: remove duplicated code (#8597)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathause authored Jan 8, 2024
1 parent e4496fe commit 08c8f9a
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions xarray/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ def _infer_dtype(array, name=None):
)
)

native_dtypes = set(np.vectorize(type, otypes=[object])(array.ravel()))
if len(native_dtypes) > 1 and native_dtypes != {bytes, str}:
raise ValueError(
"unable to infer dtype on variable {!r}; object array "
"contains mixed native types: {}".format(
name, ", ".join(x.__name__ for x in native_dtypes)
)
)

element = array[(0,) * array.ndim]
# We use the base types to avoid subclasses of bytes and str (which might
# not play nice with e.g. hdf5 datatypes), such as those from numpy
Expand Down

0 comments on commit 08c8f9a

Please sign in to comment.