Skip to content

DEPR: Deprecate pandas.np module #30386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.0.0.rst
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ Other enhancements
(:meth:`~DataFrame.to_parquet` / :func:`read_parquet`) using the `'pyarrow'` engine
now preserve those data types with pyarrow >= 1.0.0 (:issue:`20612`).
- The ``partition_cols`` argument in :meth:`DataFrame.to_parquet` now accepts a string (:issue:`27117`)
- The pandas.np submodule is now deprecated. Import numpy directly instead(:issue:`30296`)
- :func:`to_parquet` now appropriately handles the ``schema`` argument for user defined schemas in the pyarrow engine. (:issue: `30270`)
- DataFrame constructor preserve `ExtensionArray` dtype with `ExtensionArray` (:issue:`11363`)

Expand Down
14 changes: 13 additions & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
to_datetime,
to_timedelta,
# misc
np,
Grouper,
factorize,
unique,
Expand Down Expand Up @@ -211,6 +210,19 @@ class Panel:
pass

return Panel

elif name == "np":

warnings.warn(
"The pandas.np module is deprecated and will be removed from pandas in a future version. "
"Import numpy directly instead",
FutureWarning,
stacklevel=2,
)
import numpy as np

return np

elif name in {"SparseSeries", "SparseDataFrame"}:
warnings.warn(
"The {} class is removed from pandas. Accessing it from "
Expand Down
2 changes: 0 additions & 2 deletions pandas/core/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# flake8: noqa

import numpy as np

from pandas._libs import NaT, Period, Timedelta, Timestamp
from pandas._libs.missing import NA

Expand Down