Skip to content

Commit cd16475

Browse files
authored
DEPR: PandasArray alias (#58158)
* DEPR: rename PandasArray * whatsnew
1 parent efaaea8 commit cd16475

File tree

4 files changed

+1
-26
lines changed

4 files changed

+1
-26
lines changed

doc/redirects.csv

-1
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,6 @@ reference/api/pandas.Series.transpose,pandas.Series.T
14221422
reference/api/pandas.Index.transpose,pandas.Index.T
14231423
reference/api/pandas.Index.notnull,pandas.Index.notna
14241424
reference/api/pandas.Index.tolist,pandas.Index.to_list
1425-
reference/api/pandas.arrays.PandasArray,pandas.arrays.NumpyExtensionArray
14261425
reference/api/pandas.core.groupby.DataFrameGroupBy.backfill,pandas.core.groupby.DataFrameGroupBy.bfill
14271426
reference/api/pandas.core.groupby.GroupBy.backfill,pandas.core.groupby.DataFrameGroupBy.bfill
14281427
reference/api/pandas.core.resample.Resampler.backfill,pandas.core.resample.Resampler.bfill

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Removal of prior version deprecations/changes
212212
- Disallow passing a pandas type to :meth:`Index.view` (:issue:`55709`)
213213
- Disallow units other than "s", "ms", "us", "ns" for datetime64 and timedelta64 dtypes in :func:`array` (:issue:`53817`)
214214
- Removed "freq" keyword from :class:`PeriodArray` constructor, use "dtype" instead (:issue:`52462`)
215+
- Removed alias :class:`arrays.PandasArray` for :class:`arrays.NumpyExtensionArray` (:issue:`53694`)
215216
- Removed deprecated "method" and "limit" keywords from :meth:`Series.replace` and :meth:`DataFrame.replace` (:issue:`53492`)
216217
- Removed extension test classes ``BaseNoReduceTests``, ``BaseNumericReduceTests``, ``BaseBooleanReduceTests`` (:issue:`54663`)
217218
- Removed the "closed" and "normalize" keywords in :meth:`DatetimeIndex.__new__` (:issue:`52628`)

pandas/arrays/__init__.py

-17
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,3 @@
3535
"StringArray",
3636
"TimedeltaArray",
3737
]
38-
39-
40-
def __getattr__(name: str) -> type[NumpyExtensionArray]:
41-
if name == "PandasArray":
42-
# GH#53694
43-
import warnings
44-
45-
from pandas.util._exceptions import find_stack_level
46-
47-
warnings.warn(
48-
"PandasArray has been renamed NumpyExtensionArray. Use that "
49-
"instead. This alias will be removed in a future version.",
50-
FutureWarning,
51-
stacklevel=find_stack_level(),
52-
)
53-
return NumpyExtensionArray
54-
raise AttributeError(f"module 'pandas.arrays' has no attribute '{name}'")

pandas/tests/api/test_api.py

-8
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,5 @@ def test_util_in_top_level(self):
395395
pd.util.foo
396396

397397

398-
def test_pandas_array_alias():
399-
msg = "PandasArray has been renamed NumpyExtensionArray"
400-
with tm.assert_produces_warning(FutureWarning, match=msg):
401-
res = pd.arrays.PandasArray
402-
403-
assert res is pd.arrays.NumpyExtensionArray
404-
405-
406398
def test_set_module():
407399
assert pd.DataFrame.__module__ == "pandas"

0 commit comments

Comments
 (0)