|
28 | 28 | pa_version_under10p1, |
29 | 29 | ) |
30 | 30 | from pandas.compat.numpy import function as nv |
31 | | -from pandas.util._decorators import doc |
| 31 | +from pandas.util._decorators import ( |
| 32 | + doc, |
| 33 | + set_module, |
| 34 | +) |
32 | 35 | from pandas.util._exceptions import find_stack_level |
33 | 36 |
|
34 | 37 | from pandas.core.dtypes.base import ( |
|
64 | 67 | from pandas.core.construction import extract_array |
65 | 68 | from pandas.core.indexers import check_array_indexer |
66 | 69 | from pandas.core.missing import isna |
67 | | -from pandas.util._decorators import set_module |
| 70 | + |
68 | 71 | from pandas.io.formats import printing |
69 | 72 |
|
70 | 73 | if TYPE_CHECKING: |
@@ -374,6 +377,7 @@ def __from_arrow__( |
374 | 377 | NDArrayBacked.__init__(new_string_array, arr, self) |
375 | 378 | return new_string_array |
376 | 379 |
|
| 380 | + |
377 | 381 | @set_module("pandas") |
378 | 382 | class BaseStringArray(ExtensionArray): |
379 | 383 | """ |
@@ -534,6 +538,7 @@ def _str_map_nan_semantics( |
534 | 538 | # error: Definition of "_concat_same_type" in base class "NDArrayBacked" is |
535 | 539 | # incompatible with definition in base class "ExtensionArray" |
536 | 540 |
|
| 541 | + |
537 | 542 | class StringArray(BaseStringArray, NumpyExtensionArray): # type: ignore[misc] |
538 | 543 | """ |
539 | 544 | Extension array for string data. |
@@ -723,7 +728,8 @@ def __arrow_array__(self, type=None): |
723 | 728 | values[self.isna()] = None |
724 | 729 | return pa.array(values, type=type, from_pandas=True) |
725 | 730 |
|
726 | | - def _values_for_factorize(self) -> tuple[np.ndarray, libmissing.NAType | float]: # type: ignore[override] |
| 731 | + # type: ignore[override] |
| 732 | + def _values_for_factorize(self) -> tuple[np.ndarray, libmissing.NAType | float]: |
727 | 733 | arr = self._ndarray |
728 | 734 |
|
729 | 735 | return arr, self.dtype.na_value |
@@ -961,7 +967,6 @@ def _cmp_method(self, other, op): |
961 | 967 | _arith_method = _cmp_method |
962 | 968 |
|
963 | 969 |
|
964 | | - |
965 | 970 | class StringArrayNumpySemantics(StringArray): |
966 | 971 | _storage = "python" |
967 | 972 | _na_value = np.nan |
|
0 commit comments