Skip to content

Commit 1f81f47

Browse files
authored
DEPR: remove string_pyarrow option (#62715)
1 parent 012166c commit 1f81f47

File tree

5 files changed

+2
-34
lines changed

5 files changed

+2
-34
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ Other Removals
874874
- Removed the ``method`` keyword in ``ExtensionArray.fillna``, implement ``ExtensionArray._pad_or_backfill`` instead (:issue:`53621`)
875875
- Removed the attribute ``dtypes`` from :class:`.DataFrameGroupBy` (:issue:`51997`)
876876
- Enforced deprecation of ``argmin``, ``argmax``, ``idxmin``, and ``idxmax`` returning a result when ``skipna=False`` and an NA value is encountered or all values are NA values; these operations will now raise in such cases (:issue:`33941`, :issue:`51276`)
877+
- Enforced deprecation of storage option "pyarrow_numpy" for :class:`StringDtype` (:issue:`60152`)
877878
- Removed specifying ``include_groups=True`` in :class:`.DataFrameGroupBy.apply` and :class:`.Resampler.apply` (:issue:`7155`)
878879

879880
.. ---------------------------------------------------------------------------

pandas/core/arrays/string_.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -167,21 +167,6 @@ def __init__(
167167
else:
168168
storage = "python"
169169

170-
if storage == "pyarrow_numpy":
171-
# TODO: Enforce in 3.0 (#60152)
172-
warnings.warn(
173-
"The 'pyarrow_numpy' storage option name is deprecated and will be "
174-
'removed in pandas 3.0. Use \'pd.StringDtype(storage="pyarrow", '
175-
"na_value=np.nan)' to construct the same dtype.\nOr enable the "
176-
"'pd.options.future.infer_string = True' option globally and use "
177-
'the "str" alias as a shorthand notation to specify a dtype '
178-
'(instead of "string[pyarrow_numpy]").',
179-
FutureWarning, # pdlint: ignore[warning_class]
180-
stacklevel=find_stack_level(),
181-
)
182-
storage = "pyarrow"
183-
na_value = np.nan
184-
185170
# validate options
186171
if storage not in {"python", "pyarrow"}:
187172
raise ValueError(
@@ -280,9 +265,6 @@ def construct_from_string(cls, string) -> Self:
280265
return cls(storage="python")
281266
elif string == "string[pyarrow]":
282267
return cls(storage="pyarrow")
283-
elif string == "string[pyarrow_numpy]":
284-
# this is deprecated in the dtype __init__, remove this in pandas 3.0
285-
return cls(storage="pyarrow_numpy")
286268
else:
287269
raise TypeError(f"Cannot construct a '{cls.__name__}' from '{string}'")
288270

pandas/core/config_init.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,6 @@ def is_valid_string_storage(value: Any) -> None:
478478
legal_values = ["auto", "python", "pyarrow"]
479479
if value not in legal_values:
480480
msg = "Value must be one of python|pyarrow"
481-
if value == "pyarrow_numpy":
482-
# TODO: we can remove extra message after 3.0
483-
msg += (
484-
". 'pyarrow_numpy' was specified, but this option should be "
485-
"enabled using pandas.options.future.infer_string instead"
486-
)
487481
raise ValueError(msg)
488482

489483

pandas/tests/arrays/string_/test_string.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ def string_dtype_highest_priority(dtype1, dtype2):
6161
return DTYPE_HIERARCHY[max(h1, h2)]
6262

6363

64-
def test_dtype_constructor():
65-
pytest.importorskip("pyarrow")
66-
67-
with tm.assert_produces_warning(FutureWarning):
68-
dtype = pd.StringDtype("pyarrow_numpy")
69-
assert dtype == pd.StringDtype("pyarrow", na_value=np.nan)
70-
71-
7264
def test_dtype_equality():
7365
pytest.importorskip("pyarrow")
7466

pandas/tests/extension/test_string.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ def test_eq_with_str(self, dtype):
116116
# only the NA-variant supports parametrized string alias
117117
assert dtype == f"string[{dtype.storage}]"
118118
elif dtype.storage == "pyarrow":
119-
with tm.assert_produces_warning(FutureWarning):
120-
assert dtype == "string[pyarrow_numpy]"
119+
assert dtype == "str"
121120

122121
def test_is_not_string_type(self, dtype):
123122
# Different from BaseDtypeTests.test_is_not_string_type

0 commit comments

Comments
 (0)