Skip to content

Commit bb3cff9

Browse files
committed
Remove PyArrow deprecation warning (pandas-dev#57556)
* Revert "DEPS: Add warning if pyarrow is not installed (pandas-dev#56896)" This reverts commit 5c2a407 * Add whatsnew * Update * Update doc/source/whatsnew/v2.2.1.rst Co-authored-by: Matthew Roeschke <[email protected]> --------- Co-authored-by: Matthew Roeschke <[email protected]> (cherry picked from commit 4ed67ac)
1 parent 3bfedfe commit bb3cff9

File tree

5 files changed

+11
-74
lines changed

5 files changed

+11
-74
lines changed

.github/workflows/unit-tests.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ jobs:
9292
- name: "Numpy Dev"
9393
env_file: actions-311-numpydev.yaml
9494
pattern: "not slow and not network and not single_cpu"
95-
# Currently restricted the warnings that error to Deprecation Warnings from numpy
96-
# done since pyarrow isn't compatible with numpydev always
97-
# TODO: work with pyarrow to revert this?
98-
test_args: "-W error::DeprecationWarning:numpy -W error::FutureWarning:numpy"
95+
test_args: "-W error::DeprecationWarning -W error::FutureWarning"
9996
- name: "Pyarrow Nightly"
10097
env_file: actions-311-pyarrownightly.yaml
10198
pattern: "not slow and not network and not single_cpu"

doc/source/whatsnew/v2.2.1.rst

+10
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ Bug fixes
6767

6868
Other
6969
~~~~~
70+
71+
.. note::
72+
73+
The ``DeprecationWarning`` that was raised when pandas was imported without PyArrow being
74+
installed has been removed. This decision was made because the warning was too noisy for too
75+
many users and a lot of feedback was collected about the decision to make PyArrow a required
76+
dependency. Pandas is currently considering the decision whether or not PyArrow should be added
77+
as a hard dependency in 3.0. Interested users can follow the discussion
78+
`here <https://github.com/pandas-dev/pandas/issues/57073>`_.
79+
7080
- Added the argument ``skipna`` to :meth:`DataFrameGroupBy.first`, :meth:`DataFrameGroupBy.last`, :meth:`SeriesGroupBy.first`, and :meth:`SeriesGroupBy.last`; achieving ``skipna=False`` used to be available via :meth:`DataFrameGroupBy.nth`, but the behavior was changed in pandas 2.0.0 (:issue:`57019`)
7181
- Added the argument ``skipna`` to :meth:`Resampler.first`, :meth:`Resampler.last` (:issue:`57019`)
7282

pandas/__init__.py

-43
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
from __future__ import annotations
22

3-
import os
4-
import warnings
5-
63
__docformat__ = "restructuredtext"
74

85
# Let users know if they're missing any of our hard dependencies
@@ -193,46 +190,6 @@
193190
__git_version__ = v.get("full-revisionid")
194191
del get_versions, v
195192

196-
# GH#55043 - deprecation of the data_manager option
197-
if "PANDAS_DATA_MANAGER" in os.environ:
198-
warnings.warn(
199-
"The env variable PANDAS_DATA_MANAGER is set. The data_manager option is "
200-
"deprecated and will be removed in a future version. Only the BlockManager "
201-
"will be available. Unset this environment variable to silence this warning.",
202-
FutureWarning,
203-
stacklevel=2,
204-
)
205-
206-
# DeprecationWarning for missing pyarrow
207-
from pandas.compat.pyarrow import pa_version_under10p1, pa_not_found
208-
209-
if pa_version_under10p1:
210-
# pyarrow is either too old or nonexistent, warn
211-
from pandas.compat._optional import VERSIONS
212-
213-
if pa_not_found:
214-
pa_msg = "was not found to be installed on your system."
215-
else:
216-
pa_msg = (
217-
f"was too old on your system - pyarrow {VERSIONS['pyarrow']} "
218-
"is the current minimum supported version as of this release."
219-
)
220-
221-
warnings.warn(
222-
f"""
223-
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
224-
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
225-
but {pa_msg}
226-
If this would cause problems for you,
227-
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
228-
""", # noqa: E501
229-
DeprecationWarning,
230-
stacklevel=2,
231-
)
232-
del VERSIONS, pa_msg
233-
234-
# Delete all unnecessary imported modules
235-
del pa_version_under10p1, pa_not_found, warnings, os
236193

237194
# module level doc-string
238195
__doc__ = """

pandas/compat/pyarrow.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pyarrow as pa
99

1010
_palv = Version(Version(pa.__version__).base_version)
11-
pa_not_found = False
1211
pa_version_under10p1 = _palv < Version("10.0.1")
1312
pa_version_under11p0 = _palv < Version("11.0.0")
1413
pa_version_under12p0 = _palv < Version("12.0.0")
@@ -17,7 +16,6 @@
1716
pa_version_under14p1 = _palv < Version("14.0.1")
1817
pa_version_under15p0 = _palv < Version("15.0.0")
1918
except ImportError:
20-
pa_not_found = True
2119
pa_version_under10p1 = True
2220
pa_version_under11p0 = True
2321
pa_version_under12p0 = True

pandas/tests/test_common.py

-25
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import numpy as np
99
import pytest
1010

11-
import pandas.util._test_decorators as td
12-
1311
import pandas as pd
1412
from pandas import Series
1513
import pandas._testing as tm
@@ -267,26 +265,3 @@ def test_bz2_missing_import():
267265
code = textwrap.dedent(code)
268266
call = [sys.executable, "-c", code]
269267
subprocess.check_output(call)
270-
271-
272-
@td.skip_if_installed("pyarrow")
273-
@pytest.mark.parametrize("module", ["pandas", "pandas.arrays"])
274-
def test_pyarrow_missing_warn(module):
275-
# GH56896
276-
response = subprocess.run(
277-
[sys.executable, "-c", f"import {module}"],
278-
capture_output=True,
279-
check=True,
280-
)
281-
msg = """
282-
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
283-
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
284-
but was not found to be installed on your system.
285-
If this would cause problems for you,
286-
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
287-
""" # noqa: E501
288-
stderr_msg = response.stderr.decode("utf-8")
289-
# Split by \n to avoid \r\n vs \n differences on Windows/Unix
290-
# https://stackoverflow.com/questions/11989501/replacing-r-n-with-n
291-
stderr_msg = "\n".join(stderr_msg.splitlines())
292-
assert msg in stderr_msg

0 commit comments

Comments
 (0)