Skip to content

DEPS: Clean unused dependencies #61331

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 10 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 1 deletion ci/deps/actions-310-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies:

# optional dependencies
- beautifulsoup4=4.12.3
- blosc=1.21.3
- bottleneck=1.3.6
- fastparquet=2024.2.0
- fsspec=2024.2.0
Expand Down
3 changes: 1 addition & 2 deletions ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=4.12.3
- blosc>=1.21.3
- bottleneck>=1.3.6
- fastparquet>=2024.2.0
- fsspec>=2024.2.0
Expand Down Expand Up @@ -52,7 +51,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand Down
5 changes: 1 addition & 4 deletions ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=4.12.3
- blosc>=1.21.3
- bottleneck>=1.3.6
- fastparquet>=2024.2.0
- fsspec>=2024.2.0
Expand Down Expand Up @@ -53,7 +52,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand All @@ -63,14 +62,12 @@ dependencies:
- cftime
- dask
- ipython
- geopandas-base
- seaborn
- scikit-learn
- statsmodels
- coverage
- pandas-datareader
- pyyaml
- py
- pip:
- adbc-driver-postgresql>=0.10.0
- adbc-driver-sqlite>=0.8.0
Expand Down
3 changes: 1 addition & 2 deletions ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=4.12.3
- blosc>=1.21.3
- bottleneck>=1.3.6
- fastparquet>=2024.2.0
- fsspec>=2024.2.0
Expand Down Expand Up @@ -52,7 +51,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand Down
3 changes: 1 addition & 2 deletions ci/deps/actions-312.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=4.12.3
- blosc>=1.21.3
- bottleneck>=1.3.6
- fastparquet>=2024.2.0
- fsspec>=2024.2.0
Expand Down Expand Up @@ -52,7 +51,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-313.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand Down
1 change: 0 additions & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ Installable with ``pip install "pandas[hdf5, parquet, feather, spss, excel]"``
Dependency Minimum Version pip extra Notes
====================================================== ================== ================ ==========================================================
`PyTables <https://github.com/PyTables/PyTables>`__ 3.8.0 hdf5 HDF5-based reading / writing
`blosc <https://github.com/Blosc/c-blosc>`__ 1.21.3 hdf5 Compression for HDF5; only available on ``conda``
`zlib <https://github.com/madler/zlib>`__ hdf5 Compression for HDF5
`fastparquet <https://github.com/dask/fastparquet>`__ 2024.2.0 - Parquet reading / writing (pyarrow is default)
`pyarrow <https://github.com/apache/arrow>`__ 10.0.1 parquet, feather Parquet, ORC, and feather reading / writing
Expand Down
5 changes: 1 addition & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=4.12.3
- blosc
- bottleneck>=1.3.6
- fastparquet>=2024.2.0
- fsspec>=2024.2.0
Expand Down Expand Up @@ -55,7 +54,7 @@ dependencies:
- scipy>=1.12.0
- sqlalchemy>=2.0.0
- tabulate>=0.9.0
- xarray>=2024.1.1, <=2024.9.0
- xarray>=2024.1.1
- xlrd>=2.0.1
- xlsxwriter>=3.2.0
- zstandard>=0.22.0
Expand Down Expand Up @@ -83,8 +82,6 @@ dependencies:

# documentation
- gitpython # obtain contributors from git for whatsnew
- gitdb
- google-auth
- natsort # DataFrame.sort_values doctest
- numpydoc
- pydata-sphinx-theme=0.16
Expand Down
1 change: 0 additions & 1 deletion pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"adbc-driver-postgresql": "0.10.0",
"adbc-driver-sqlite": "0.8.0",
"bs4": "4.12.3",
"blosc": "1.21.3",
"bottleneck": "1.3.6",
"fastparquet": "2024.2.0",
"fsspec": "2024.2.0",
Expand Down
52 changes: 28 additions & 24 deletions pandas/tests/generic/test_to_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
DataFrame,
MultiIndex,
Series,
StringDtype,
date_range,
)
import pandas._testing as tm
from pandas.util.version import Version

pytest.importorskip("xarray")
xarray = pytest.importorskip("xarray")


class TestDataFrameToXArray:
Expand All @@ -29,13 +31,17 @@ def df(self):
}
)

def test_to_xarray_index_types(self, index_flat, df, using_infer_string):
def test_to_xarray_index_types(self, index_flat, df, request):
index = index_flat
# MultiIndex is tested in test_to_xarray_with_multiindex
if len(index) == 0:
pytest.skip("Test doesn't make sense for empty index")

from xarray import Dataset
elif Version(xarray.__version__) <= Version("2024.9.0"):
request.applymarker(
pytest.mark.xfail(
reason="Categorical column not preserved.",
)
)

df.index = index[:4]
df.index.name = "foo"
Expand All @@ -45,29 +51,22 @@ def test_to_xarray_index_types(self, index_flat, df, using_infer_string):
assert len(result.coords) == 1
assert len(result.data_vars) == 8
tm.assert_almost_equal(list(result.coords.keys()), ["foo"])
assert isinstance(result, Dataset)
assert isinstance(result, xarray.Dataset)

# idempotency
# datetimes w/tz are preserved
# column names are lost
expected = df.copy()
expected["f"] = expected["f"].astype(
object if not using_infer_string else "str"
)
expected.columns.name = None
tm.assert_frame_equal(result.to_dataframe(), expected)

def test_to_xarray_empty(self, df):
from xarray import Dataset

df.index.name = "foo"
result = df[0:0].to_xarray()
assert result.sizes["foo"] == 0
assert isinstance(result, Dataset)
assert isinstance(result, xarray.Dataset)

def test_to_xarray_with_multiindex(self, df, using_infer_string):
from xarray import Dataset

# MultiIndex
df.index = MultiIndex.from_product([["a"], range(4)], names=["one", "two"])
result = df.to_xarray()
Expand All @@ -76,7 +75,7 @@ def test_to_xarray_with_multiindex(self, df, using_infer_string):
assert len(result.coords) == 2
assert len(result.data_vars) == 8
tm.assert_almost_equal(list(result.coords.keys()), ["one", "two"])
assert isinstance(result, Dataset)
assert isinstance(result, xarray.Dataset)

result = result.to_dataframe()
expected = df.copy()
Expand All @@ -88,43 +87,48 @@ def test_to_xarray_with_multiindex(self, df, using_infer_string):


class TestSeriesToXArray:
def test_to_xarray_index_types(self, index_flat):
def test_to_xarray_index_types(self, index_flat, request):
index = index_flat
if (
isinstance(index.dtype, StringDtype)
and index.dtype.storage == "pyarrow"
and Version(xarray.__version__) > Version("2024.9.0")
):
request.applymarker(
pytest.mark.xfail(
reason="xarray calling reshape of ArrowExtensionArray",
raises=NotImplementedError,
)
)
# MultiIndex is tested in test_to_xarray_with_multiindex

from xarray import DataArray

ser = Series(range(len(index)), index=index, dtype="int64")
ser.index.name = "foo"
result = ser.to_xarray()
repr(result)
assert len(result) == len(index)
assert len(result.coords) == 1
tm.assert_almost_equal(list(result.coords.keys()), ["foo"])
assert isinstance(result, DataArray)
assert isinstance(result, xarray.DataArray)

# idempotency
tm.assert_series_equal(result.to_series(), ser)

def test_to_xarray_empty(self):
from xarray import DataArray

ser = Series([], dtype=object)
ser.index.name = "foo"
result = ser.to_xarray()
assert len(result) == 0
assert len(result.coords) == 1
tm.assert_almost_equal(list(result.coords.keys()), ["foo"])
assert isinstance(result, DataArray)
assert isinstance(result, xarray.DataArray)

def test_to_xarray_with_multiindex(self):
from xarray import DataArray

mi = MultiIndex.from_product([["a", "b"], range(3)], names=["one", "two"])
ser = Series(range(6), dtype="int64", index=mi)
result = ser.to_xarray()
assert len(result) == 2
tm.assert_almost_equal(list(result.coords.keys()), ["one", "two"])
assert isinstance(result, DataArray)
assert isinstance(result, xarray.DataArray)
res = result.to_series()
tm.assert_series_equal(res, ser)
2 changes: 1 addition & 1 deletion pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_xarray_cftimeindex_nearest():
cftime = pytest.importorskip("cftime")
xarray = pytest.importorskip("xarray")

times = xarray.cftime_range("0001", periods=2)
times = xarray.date_range("0001", periods=2, use_cftime=True)
key = cftime.DatetimeGregorian(2000, 1, 1)
result = times.get_indexer([key], method="nearest")
expected = 1
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ gcp = ['gcsfs>=2024.2.0']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.1.2', 'python-calamine>=0.1.7', 'pyxlsb>=1.0.10', 'xlrd>=2.0.1', 'xlsxwriter>=3.2.0']
parquet = ['pyarrow>=10.0.1']
feather = ['pyarrow>=10.0.1']
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.20.1',
'tables>=3.8.0']
hdf5 = ['tables>=3.8.0']
spss = ['pyreadstat>=1.2.6']
postgresql = ['SQLAlchemy>=2.0.0', 'psycopg2>=2.9.6', 'adbc-driver-postgresql>=0.10.0']
mysql = ['SQLAlchemy>=2.0.0', 'pymysql>=1.1.0']
Expand All @@ -85,8 +83,6 @@ timezone = ['pytz>=2023.4']
all = ['adbc-driver-postgresql>=0.10.0',
'adbc-driver-sqlite>=0.8.0',
'beautifulsoup4>=4.12.3',
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.21.3',
'bottleneck>=1.3.6',
'fastparquet>=2024.2.0',
'fsspec>=2024.2.0',
Expand Down
5 changes: 1 addition & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ coverage
python-dateutil
numpy<3
beautifulsoup4>=4.12.3
blosc
bottleneck>=1.3.6
fastparquet>=2024.2.0
fsspec>=2024.2.0
Expand Down Expand Up @@ -44,7 +43,7 @@ s3fs>=2024.2.0
scipy>=1.12.0
SQLAlchemy>=2.0.0
tabulate>=0.9.0
xarray>=2024.1.1, <=2024.9.0
xarray>=2024.1.1
xlrd>=2.0.1
xlsxwriter>=3.2.0
zstandard>=0.22.0
Expand All @@ -58,8 +57,6 @@ mypy==1.13.0
tokenize-rt
pre-commit>=4.2.0
gitpython
gitdb
google-auth
natsort
numpydoc
pydata-sphinx-theme==0.16
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/data/deps_expected_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies:

# optional dependencies
- beautifulsoup4>=5.9.3
- blosc
- bottleneck>=1.3.2
- fastparquet>=0.6.3
- fsspec>=2021.07.0
Expand Down
6 changes: 1 addition & 5 deletions scripts/tests/data/deps_minimum.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ gcp = ['gcsfs>=2021.07.0']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'python-calamine>=0.1.7', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
parquet = ['pyarrow>=7.0.0']
feather = ['pyarrow>=7.0.0']
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.20.1',
'tables>=3.6.1']
hdf5 = ['tables>=3.6.1']
spss = ['pyreadstat>=1.1.2']
postgresql = ['SQLAlchemy>=1.4.16', 'psycopg2>=2.8.6']
mysql = ['SQLAlchemy>=1.4.16', 'pymysql>=1.1.0']
Expand All @@ -77,8 +75,6 @@ output_formatting = ['jinja2>=3.0.0', 'tabulate>=0.8.9']
clipboard = ['PyQt5>=5.15.1', 'qtpy>=2.3.0']
compression = ['zstandard>=0.15.2']
all = ['beautifulsoup4>=5.9.3',
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.21.0',
'bottleneck>=1.3.2',
'fastparquet>=0.6.3',
'fsspec>=2021.07.0',
Expand Down
1 change: 0 additions & 1 deletion scripts/tests/data/deps_unmodified_random.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies:

# optional dependencies
- beautifulsoup4
- blosc
- bottleneck>=1.3.2
- fastparquet>=0.6.3
- fsspec>=2021.07.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate_min_versions_in_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
SETUP_PATH = pathlib.Path("pyproject.toml").resolve()
YAML_PATH = pathlib.Path("ci/deps")
ENV_PATH = pathlib.Path("environment.yml")
EXCLUDE_DEPS = {"tzdata", "blosc", "pyqt", "pyqt5"}
EXCLUDE_DEPS = {"tzdata", "pyqt", "pyqt5"}
EXCLUSION_LIST = frozenset(["python=3.8[build=*_pypy]"])
# pandas package is not available
# in pre-commit environment
Expand Down
Loading