Skip to content

Commit

Permalink
Update indexing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Sep 21, 2024
1 parent 17346f7 commit 1173cc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xarray/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class ExplicitlyIndexed:

def __array__(self, dtype: np.typing.DTypeLike = None) -> np.ndarray:
# Leave casting to an array up to the underlying array type.
return np.asarray(self.get_duck_array(), dtype=dtype, copy=copy)
return np.asarray(self.get_duck_array(), dtype=dtype)

def get_duck_array(self):
return self.array
Expand Down Expand Up @@ -1682,7 +1682,7 @@ def __array__(self, dtype: DTypeLike = None) -> np.ndarray:
with suppress(AttributeError):
# this might not be public API
array = array.astype("object")
return np.asarray(array.values, dtype=dtype, copy=copy)
return np.asarray(array.values, dtype=dtype)

def get_duck_array(self) -> np.ndarray:
return np.asarray(self)
Expand Down Expand Up @@ -1839,7 +1839,7 @@ def __array__(self, dtype: DTypeLike = None) -> np.ndarray:
self.array.get_level_values(self.level).values, dtype=dtype
)
else:
return super().__array__(dtype, copy=copy)
return super().__array__(dtype)

def _convert_scalar(self, item):
if isinstance(item, tuple) and self.level is not None:
Expand Down

0 comments on commit 1173cc0

Please sign in to comment.