Skip to content

Commit 5bcad4e

Browse files
fix typing
1 parent a55d441 commit 5bcad4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/arrays/numpy_.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Any,
66
Literal,
77
Self,
8+
cast,
89
)
910

1011
import numpy as np
@@ -48,6 +49,7 @@
4849
)
4950

5051
from pandas import Index
52+
from pandas.arrays import StringArray
5153

5254

5355
class NumpyExtensionArray(
@@ -234,8 +236,9 @@ def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
234236
# e.g. test_np_max_nested_tuples
235237
return result
236238
else:
237-
if self.dtype.type is str:
239+
if self.dtype.type is str: # type: ignore[comparison-overlap]
238240
# StringDtype
241+
self = cast("StringArray", self)
239242
try:
240243
# specify dtype to preserve storage/na_value
241244
return type(self)(result, dtype=self.dtype)

0 commit comments

Comments
 (0)