Skip to content

Commit 08c8f9a

Browse files
authored
_infer_dtype: remove duplicated code (#8597)
1 parent e4496fe commit 08c8f9a

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

xarray/conventions.py

-9
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ def _infer_dtype(array, name=None):
6969
)
7070
)
7171

72-
native_dtypes = set(np.vectorize(type, otypes=[object])(array.ravel()))
73-
if len(native_dtypes) > 1 and native_dtypes != {bytes, str}:
74-
raise ValueError(
75-
"unable to infer dtype on variable {!r}; object array "
76-
"contains mixed native types: {}".format(
77-
name, ", ".join(x.__name__ for x in native_dtypes)
78-
)
79-
)
80-
8172
element = array[(0,) * array.ndim]
8273
# We use the base types to avoid subclasses of bytes and str (which might
8374
# not play nice with e.g. hdf5 datatypes), such as those from numpy

0 commit comments

Comments
 (0)