Skip to content

Commit 7265e5c

Browse files
committed
Merge main
2 parents 52dbb5e + ae42f3e commit 7265e5c

File tree

96 files changed

+2068
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2068
-406
lines changed

.github/workflows/unit-tests.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ defaults:
2222

2323
jobs:
2424
ubuntu:
25-
runs-on: ubuntu-22.04
25+
runs-on: ${{ matrix.platform }}
2626
timeout-minutes: 90
2727
strategy:
2828
matrix:
29+
platform: [ubuntu-22.04, ubuntu-24.04-arm]
2930
env_file: [actions-310.yaml, actions-311.yaml, actions-312.yaml]
3031
# Prevent the include jobs from overriding other jobs
3132
pattern: [""]
@@ -35,9 +36,11 @@ jobs:
3536
env_file: actions-311-downstream_compat.yaml
3637
pattern: "not slow and not network and not single_cpu"
3738
pytest_target: "pandas/tests/test_downstream.py"
39+
platform: ubuntu-22.04
3840
- name: "Minimum Versions"
3941
env_file: actions-310-minimum_versions.yaml
4042
pattern: "not slow and not network and not single_cpu"
43+
platform: ubuntu-22.04
4144
- name: "Locale: it_IT"
4245
env_file: actions-311.yaml
4346
pattern: "not slow and not network and not single_cpu"
@@ -48,6 +51,7 @@ jobs:
4851
# Also install it_IT (its encoding is ISO8859-1) but do not activate it.
4952
# It will be temporarily activated during tests with locale.setlocale
5053
extra_loc: "it_IT"
54+
platform: ubuntu-22.04
5155
- name: "Locale: zh_CN"
5256
env_file: actions-311.yaml
5357
pattern: "not slow and not network and not single_cpu"
@@ -58,25 +62,31 @@ jobs:
5862
# Also install zh_CN (its encoding is gb2312) but do not activate it.
5963
# It will be temporarily activated during tests with locale.setlocale
6064
extra_loc: "zh_CN"
65+
platform: ubuntu-22.04
6166
- name: "Future infer strings"
6267
env_file: actions-312.yaml
6368
pandas_future_infer_string: "1"
69+
platform: ubuntu-22.04
6470
- name: "Future infer strings (without pyarrow)"
6571
env_file: actions-311.yaml
6672
pandas_future_infer_string: "1"
73+
platform: ubuntu-22.04
6774
- name: "Pypy"
6875
env_file: actions-pypy-39.yaml
6976
pattern: "not slow and not network and not single_cpu"
7077
test_args: "--max-worker-restart 0"
78+
platform: ubuntu-22.04
7179
- name: "Numpy Dev"
7280
env_file: actions-311-numpydev.yaml
7381
pattern: "not slow and not network and not single_cpu"
7482
test_args: "-W error::DeprecationWarning -W error::FutureWarning"
83+
platform: ubuntu-22.04
7584
- name: "Pyarrow Nightly"
7685
env_file: actions-311-pyarrownightly.yaml
7786
pattern: "not slow and not network and not single_cpu"
87+
platform: ubuntu-22.04
7888
fail-fast: false
79-
name: ${{ matrix.name || format('ubuntu-latest {0}', matrix.env_file) }}
89+
name: ${{ matrix.name || format('{0} {1}', matrix.platform, matrix.env_file) }}
8090
env:
8191
PATTERN: ${{ matrix.pattern }}
8292
LANG: ${{ matrix.lang || 'C.UTF-8' }}
@@ -91,7 +101,7 @@ jobs:
91101
REMOVE_PYARROW: ${{ matrix.name == 'Future infer strings (without pyarrow)' && '1' || '0' }}
92102
concurrency:
93103
# https://github.community/t/concurrecy-not-work-for-push/183068/7
94-
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.extra_apt || '' }}-${{ matrix.pandas_future_infer_string }}
104+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-${{ matrix.pattern }}-${{ matrix.extra_apt || '' }}-${{ matrix.pandas_future_infer_string }}-${{ matrix.platform }}
95105
cancel-in-progress: true
96106

97107
services:

.github/workflows/wheels.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ jobs:
9494
buildplat:
9595
- [ubuntu-22.04, manylinux_x86_64]
9696
- [ubuntu-22.04, musllinux_x86_64]
97-
- [macos-12, macosx_x86_64]
97+
- [ubuntu-24.04-arm, manylinux_aarch64]
98+
- [macos-13, macosx_x86_64]
9899
# Note: M1 images on Github Actions start from macOS 14
99100
- [macos-14, macosx_arm64]
100101
- [windows-2022, win_amd64]

.pre-commit-config.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ci:
1919
skip: [pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.8.1
22+
rev: v0.8.6
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -34,7 +34,7 @@ repos:
3434
- id: ruff-format
3535
exclude: ^scripts|^pandas/tests/frame/test_query_eval.py
3636
- repo: https://github.com/jendrikseipp/vulture
37-
rev: 'v2.13'
37+
rev: 'v2.14'
3838
hooks:
3939
- id: vulture
4040
entry: python scripts/run_vulture.py
@@ -74,7 +74,7 @@ repos:
7474
hooks:
7575
- id: isort
7676
- repo: https://github.com/asottile/pyupgrade
77-
rev: v3.19.0
77+
rev: v3.19.1
7878
hooks:
7979
- id: pyupgrade
8080
args: [--py310-plus]
@@ -95,12 +95,17 @@ repos:
9595
- id: sphinx-lint
9696
args: ["--enable", "all", "--disable", "line-too-long"]
9797
- repo: https://github.com/pre-commit/mirrors-clang-format
98-
rev: v19.1.4
98+
rev: v19.1.6
9999
hooks:
100100
- id: clang-format
101101
files: ^pandas/_libs/src|^pandas/_libs/include
102102
args: [-i]
103103
types_or: [c, c++]
104+
- repo: https://github.com/trim21/pre-commit-mirror-meson
105+
rev: v1.6.1
106+
hooks:
107+
- id: meson-fmt
108+
args: ['--inplace']
104109
- repo: local
105110
hooks:
106111
- id: pyright

asv_bench/benchmarks/io/csv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def setup(self):
594594
self.StringIO_input = StringIO(data)
595595

596596
def time_read_csv_index_col(self):
597-
read_csv(self.StringIO_input, index_col="a")
597+
read_csv(self.data(self.StringIO_input), index_col="a")
598598

599599

600600
class ReadCSVDatePyarrowEngine(StringIORewind):
@@ -605,7 +605,7 @@ def setup(self):
605605

606606
def time_read_csv_index_col(self):
607607
read_csv(
608-
self.StringIO_input,
608+
self.data(self.StringIO_input),
609609
parse_dates=["a"],
610610
engine="pyarrow",
611611
dtype_backend="pyarrow",

ci/code_checks.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
7373
-i "pandas.Period.freq GL08" \
7474
-i "pandas.Period.ordinal GL08" \
75-
-i "pandas.RangeIndex.from_range PR01,SA01" \
7675
-i "pandas.Timedelta.max PR02" \
7776
-i "pandas.Timedelta.min PR02" \
7877
-i "pandas.Timedelta.resolution PR02" \
7978
-i "pandas.Timestamp.max PR02" \
8079
-i "pandas.Timestamp.min PR02" \
8180
-i "pandas.Timestamp.resolution PR02" \
8281
-i "pandas.Timestamp.tzinfo GL08" \
83-
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \
8482
-i "pandas.arrays.TimedeltaArray PR07,SA01" \
8583
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
8684
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \

doc/source/reference/groupby.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Function application
104104
DataFrameGroupBy.shift
105105
DataFrameGroupBy.size
106106
DataFrameGroupBy.skew
107+
DataFrameGroupBy.kurt
107108
DataFrameGroupBy.std
108109
DataFrameGroupBy.sum
109110
DataFrameGroupBy.var
@@ -159,6 +160,7 @@ Function application
159160
SeriesGroupBy.shift
160161
SeriesGroupBy.size
161162
SeriesGroupBy.skew
163+
SeriesGroupBy.kurt
162164
SeriesGroupBy.std
163165
SeriesGroupBy.sum
164166
SeriesGroupBy.var

doc/source/reference/window.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ Rolling window functions
3030
Rolling.std
3131
Rolling.min
3232
Rolling.max
33+
Rolling.first
34+
Rolling.last
3335
Rolling.corr
3436
Rolling.cov
3537
Rolling.skew
3638
Rolling.kurt
3739
Rolling.apply
40+
Rolling.pipe
3841
Rolling.aggregate
3942
Rolling.quantile
4043
Rolling.sem
@@ -71,11 +74,14 @@ Expanding window functions
7174
Expanding.std
7275
Expanding.min
7376
Expanding.max
77+
Expanding.first
78+
Expanding.last
7479
Expanding.corr
7580
Expanding.cov
7681
Expanding.skew
7782
Expanding.kurt
7883
Expanding.apply
84+
Expanding.pipe
7985
Expanding.aggregate
8086
Expanding.quantile
8187
Expanding.sem

doc/source/user_guide/io.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,6 +2340,7 @@ Read a URL with no options:
23402340
.. code-block:: ipython
23412341
23422342
In [320]: url = "https://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list"
2343+
23432344
In [321]: pd.read_html(url)
23442345
Out[321]:
23452346
[ Bank NameBank CityCity StateSt ... Acquiring InstitutionAI Closing DateClosing FundFund
@@ -2366,6 +2367,7 @@ Read a URL while passing headers alongside the HTTP request:
23662367
.. code-block:: ipython
23672368
23682369
In [322]: url = 'https://www.sump.org/notes/request/' # HTTP request reflector
2370+
23692371
In [323]: pd.read_html(url)
23702372
Out[323]:
23712373
[ 0 1
@@ -2378,14 +2380,16 @@ Read a URL while passing headers alongside the HTTP request:
23782380
1 Host: www.sump.org
23792381
2 User-Agent: Python-urllib/3.8
23802382
3 Connection: close]
2383+
23812384
In [324]: headers = {
2382-
In [325]: 'User-Agent':'Mozilla Firefox v14.0',
2383-
In [326]: 'Accept':'application/json',
2384-
In [327]: 'Connection':'keep-alive',
2385-
In [328]: 'Auth':'Bearer 2*/f3+fe68df*4'
2386-
In [329]: }
2387-
In [340]: pd.read_html(url, storage_options=headers)
2388-
Out[340]:
2385+
.....: 'User-Agent':'Mozilla Firefox v14.0',
2386+
.....: 'Accept':'application/json',
2387+
.....: 'Connection':'keep-alive',
2388+
.....: 'Auth':'Bearer 2*/f3+fe68df*4'
2389+
.....: }
2390+
2391+
In [325]: pd.read_html(url, storage_options=headers)
2392+
Out[325]:
23892393
[ 0 1
23902394
0 Remote Socket: 51.15.105.256:51760
23912395
1 Protocol Version: HTTP/1.1

doc/source/whatsnew/v2.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Other enhancements
3636
when using ``np.array()`` or ``np.asarray()`` on pandas objects) has been
3737
updated to work correctly with NumPy >= 2 (:issue:`57739`)
3838
- :meth:`~Series.to_hdf` and :meth:`~DataFrame.to_hdf` now round-trip with ``StringDtype`` (:issue:`60663`)
39+
- The :meth:`~Series.cumsum`, :meth:`~Series.cummin`, and :meth:`~Series.cummax` reductions are now implemented for ``StringDtype`` columns when backed by PyArrow (:issue:`60633`)
3940
- The :meth:`~Series.sum` reduction is now implemented for ``StringDtype`` columns (:issue:`59853`)
4041

4142
.. ---------------------------------------------------------------------------
@@ -175,7 +176,6 @@ Other
175176
^^^^^
176177
- Fixed usage of ``inspect`` when the optional dependencies ``pyarrow`` or ``jinja2``
177178
are not installed (:issue:`60196`)
178-
-
179179

180180
.. ---------------------------------------------------------------------------
181181
.. _whatsnew_230.contributors:

doc/source/whatsnew/v3.0.0.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Other enhancements
3030
^^^^^^^^^^^^^^^^^^
3131
- :class:`pandas.api.typing.FrozenList` is available for typing the outputs of :attr:`MultiIndex.names`, :attr:`MultiIndex.codes` and :attr:`MultiIndex.levels` (:issue:`58237`)
3232
- :class:`pandas.api.typing.SASReader` is available for typing the output of :func:`read_sas` (:issue:`55689`)
33+
- :meth:`pandas.api.interchange.from_dataframe` now uses the `PyCapsule Interface <https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html>`_ if available, only falling back to the Dataframe Interchange Protocol if that fails (:issue:`60739`)
34+
- :class:`pandas.api.typing.NoDefault` is available for typing ``no_default``
3335
- :func:`DataFrame.to_excel` now raises an ``UserWarning`` when the character count in a cell exceeds Excel's limitation of 32767 characters (:issue:`56954`)
3436
- :func:`pandas.merge` now validates the ``how`` parameter input (merge type) (:issue:`59435`)
3537
- :func:`read_spss` now supports kwargs to be passed to pyreadstat (:issue:`56356`)
@@ -44,17 +46,22 @@ Other enhancements
4446
- Users can globally disable any ``PerformanceWarning`` by setting the option ``mode.performance_warnings`` to ``False`` (:issue:`56920`)
4547
- :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
4648
- :class:`.errors.DtypeWarning` improved to include column names when mixed data types are detected (:issue:`58174`)
49+
- :class:`Rolling` and :class:`Expanding` now support ``pipe`` method (:issue:`57076`)
4750
- :class:`Series` now supports the Arrow PyCapsule Interface for export (:issue:`59518`)
4851
- :func:`DataFrame.to_excel` argument ``merge_cells`` now accepts a value of ``"columns"`` to only merge :class:`MultiIndex` column header header cells (:issue:`35384`)
4952
- :meth:`DataFrame.corrwith` now accepts ``min_periods`` as optional arguments, as in :meth:`DataFrame.corr` and :meth:`Series.corr` (:issue:`9490`)
5053
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
5154
- :meth:`DataFrame.ewm` now allows ``adjust=False`` when ``times`` is provided (:issue:`54328`)
5255
- :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept ``value=None``; for non-object dtype the corresponding NA value will be used (:issue:`57723`)
5356
- :meth:`DataFrame.pivot_table` and :func:`pivot_table` now allow the passing of keyword arguments to ``aggfunc`` through ``**kwargs`` (:issue:`57884`)
57+
- :meth:`DataFrame.to_json` now encodes ``Decimal`` as strings instead of floats (:issue:`60698`)
5458
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
5559
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
5660
- :meth:`DataFrame.plot.scatter` argument ``c`` now accepts a column of strings, where rows with the same string are colored identically (:issue:`16827` and :issue:`16485`)
61+
- :class:`Rolling` and :class:`Expanding` now support aggregations ``first`` and ``last`` (:issue:`33155`)
5762
- :func:`read_parquet` accepts ``to_pandas_kwargs`` which are forwarded to :meth:`pyarrow.Table.to_pandas` which enables passing additional keywords to customize the conversion to pandas, such as ``maps_as_pydicts`` to read the Parquet map data type as python dictionaries (:issue:`56842`)
63+
- :meth:`.DataFrameGroupBy.mean`, :meth:`.DataFrameGroupBy.sum`, :meth:`.SeriesGroupBy.mean` and :meth:`.SeriesGroupBy.sum` now accept ``skipna`` parameter (:issue:`15675`)
64+
- :meth:`.DataFrameGroupBy.transform`, :meth:`.SeriesGroupBy.transform`, :meth:`.DataFrameGroupBy.agg`, :meth:`.SeriesGroupBy.agg`, :meth:`.SeriesGroupBy.apply`, :meth:`.DataFrameGroupBy.apply` now support ``kurt`` (:issue:`40139`)
5865
- :meth:`DataFrameGroupBy.transform`, :meth:`SeriesGroupBy.transform`, :meth:`DataFrameGroupBy.agg`, :meth:`SeriesGroupBy.agg`, :meth:`RollingGroupby.apply`, :meth:`ExpandingGroupby.apply`, :meth:`Rolling.apply`, :meth:`Expanding.apply`, :meth:`DataFrame.apply` with ``engine="numba"`` now supports positional arguments passed as kwargs (:issue:`58995`)
5966
- :meth:`Rolling.agg`, :meth:`Expanding.agg` and :meth:`ExponentialMovingWindow.agg` now accept :class:`NamedAgg` aggregations through ``**kwargs`` (:issue:`28333`)
6067
- :meth:`Series.map` can now accept kwargs to pass on to func (:issue:`59814`)
@@ -685,6 +692,7 @@ MultiIndex
685692
- :meth:`DataFrame.melt` would not accept multiple names in ``var_name`` when the columns were a :class:`MultiIndex` (:issue:`58033`)
686693
- :meth:`MultiIndex.insert` would not insert NA value correctly at unified location of index -1 (:issue:`59003`)
687694
- :func:`MultiIndex.get_level_values` accessing a :class:`DatetimeIndex` does not carry the frequency attribute along (:issue:`58327`, :issue:`57949`)
695+
- Bug in :class:`DataFrame` arithmetic operations in case of unaligned MultiIndex columns (:issue:`60498`)
688696
-
689697

690698
I/O
@@ -798,13 +806,15 @@ Other
798806
- Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
799807
- Bug in :meth:`Series.rank` that doesn't preserve missing values for nullable integers when ``na_option='keep'``. (:issue:`56976`)
800808
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when ``regex=True`` and missing values are present. (:issue:`56599`)
809+
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` throwing ``ValueError`` when ``regex=True`` and all NA values. (:issue:`60688`)
801810
- Bug in :meth:`Series.to_string` when series contains complex floats with exponents (:issue:`60405`)
802811
- Bug in :meth:`read_csv` where chained fsspec TAR file and ``compression="infer"`` fails with ``tarfile.ReadError`` (:issue:`60028`)
803812
- Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
804813
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
805814
- Bug in ``Series.list`` methods not preserving the original name. (:issue:`60522`)
806815
- Bug in printing a :class:`DataFrame` with a :class:`DataFrame` stored in :attr:`DataFrame.attrs` raised a ``ValueError`` (:issue:`60455`)
807816
- Bug in printing a :class:`Series` with a :class:`DataFrame` stored in :attr:`Series.attrs` raised a ``ValueError`` (:issue:`60568`)
817+
- Fixed regression in :meth:`DataFrame.from_records` not initializing subclasses properly (:issue:`57008`)
808818

809819
.. ***DO NOT USE THIS SECTION***
810820

0 commit comments

Comments
 (0)