Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Apr 27, 2024
1 parent 0eee625 commit 607b95e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pandas/_testing/asserters.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,11 @@ def assert_extension_array_equal(
# Specifically for StringArrayNumpySemantics, validate here we have a valid array
if isinstance(left.dtype, StringDtype) and left.dtype.storage == "python_numpy":
assert np.all(
[np.isnan(val) for val in left._ndarray[left_na]]
[np.isnan(val) for val in left._ndarray[left_na]] # type: ignore[attr-defined]
), "wrong missing value sentinels"
if isinstance(right.dtype, StringDtype) and right.dtype.storage == "python_numpy":
assert np.all(
[np.isnan(val) for val in right._ndarray[right_na]]
[np.isnan(val) for val in right._ndarray[right_na]] # type: ignore[attr-defined]
), "wrong missing value sentinels"

left_valid = left[~left_na].to_numpy(dtype=object)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/string_.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def _from_sequence(
dtype = StringDtype(storage="python_numpy")
return super()._from_sequence(scalars, dtype=dtype, copy=copy)

def _from_backing_data(self, arr: np.ndarray) -> NumpyExtensionArray:
def _from_backing_data(self, arr: np.ndarray) -> StringArrayNumpySemantics:
# need to overrde NumpyExtensionArray._from_backing_data to ensure
# we always preserve the dtype
return NDArrayBacked._from_backing_data(self, arr)
Expand Down

0 comments on commit 607b95e

Please sign in to comment.