Skip to content

Commit 959451e

Browse files
Merge remote-tracking branch 'upstream/main' into cow-ea-readonly
2 parents 0af4b39 + e817930 commit 959451e

Some content is hidden

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

80 files changed

+1139
-510
lines changed

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,6 @@ jobs:
358358
359359
- name: Run Tests
360360
uses: ./.github/actions/run-tests
361-
# TEMP allow this to fail until we fixed all test failures (related to chained assignment warnings)
362-
continue-on-error: true
363361

364362
# NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml
365363
emscripten:

.github/workflows/wheels.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
name: Wheel builder
1414

1515
on:
16+
release:
17+
types: [published]
1618
schedule:
1719
# 3:27 UTC every day
1820
- cron: "27 3 * * *"
@@ -101,7 +103,7 @@ jobs:
101103
- [macos-14, macosx_arm64]
102104
- [windows-2022, win_amd64]
103105
- [windows-11-arm, win_arm64]
104-
python: [["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"]]
106+
python: [["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"], ["cp314", "3.14"], ["cp314t", "3.14"]]
105107
include:
106108
# Build Pyodide wheels and upload them to Anaconda.org
107109
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
@@ -216,3 +218,41 @@ jobs:
216218
source ci/upload_wheels.sh
217219
set_upload_vars
218220
upload_wheels
221+
222+
publish:
223+
if: >
224+
github.repository == 'pandas-dev/pandas' &&
225+
github.event_name == 'release' &&
226+
startsWith(github.ref, 'refs/tags/v')
227+
228+
needs:
229+
- build_sdist
230+
- build_wheels
231+
232+
runs-on: ubuntu-latest
233+
234+
environment:
235+
name: pypi
236+
permissions:
237+
id-token: write # OIDC for Trusted Publishing
238+
contents: read
239+
240+
steps:
241+
- name: Download all artefacts
242+
uses: actions/download-artifact@v4
243+
with:
244+
path: dist # everything lands in ./dist/**
245+
246+
- name: Collect files
247+
run: |
248+
mkdir -p upload
249+
# skip any wheel that contains 'pyodide'
250+
find dist -name '*pyodide*.whl' -prune -o \
251+
-name '*.whl' -exec mv {} upload/ \;
252+
find dist -name '*.tar.gz' -exec mv {} upload/ \;
253+
254+
- name: Publish to **PyPI** (Trusted Publishing)
255+
uses: pypa/gh-action-pypi-publish@release/v1
256+
with:
257+
packages-dir: upload
258+
skip-existing: true

doc/source/development/contributing_codebase.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ With custom types and inference this is not always possible so exceptions are ma
214214
pandas-specific types
215215
~~~~~~~~~~~~~~~~~~~~~
216216

217-
Commonly used types specific to pandas will appear in `pandas._typing <https://github.com/pandas-dev/pandas/blob/main/pandas/_typing.py>`_ and you should use these where applicable. This module is private for now but ultimately this should be exposed to third party libraries who want to implement type checking against pandas.
217+
Commonly used types specific to pandas will appear in `pandas._typing <https://github.com/pandas-dev/pandas/blob/main/pandas/_typing.py>`__ and you should use these where applicable. This module is private and is meant for pandas development.
218+
Types that are meant for user consumption should be exposed in `pandas.api.typing.aliases <https://github.com/pandas-dev/pandas/blob/main/pandas/api/typing/aliases.py>`__ and ideally added to the `pandas-stubs <https://github.com/pandas-dev/pandas-stubs>`__ project.
218219

219220
For example, quite a few functions in pandas accept a ``dtype`` argument. This can be expressed as a string like ``"object"``, a ``numpy.dtype`` like ``np.int64`` or even a pandas ``ExtensionDtype`` like ``pd.CategoricalDtype``. Rather than burden the user with having to constantly annotate all of those options, this can simply be imported and reused from the pandas._typing module
220221

doc/source/development/maintaining.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,10 @@ which will be triggered when the tag is pushed.
451451
- Set as the latest release: Leave checked, unless releasing a patch release for an older version
452452
(e.g. releasing 1.4.5 after 1.5 has been released)
453453

454-
5. Upload wheels to PyPI::
455-
456-
twine upload pandas/dist/pandas-<version>*.{whl,tar.gz} --skip-existing
454+
5. Verify wheels are uploaded automatically by GitHub Actions
455+
via `**Trusted Publishing** <https://docs.pypi.org/trusted-publishers/>`__
456+
when the GitHub `*Release* <https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases>`__
457+
is published. Do not run ``twine upload`` manually.
457458

458459
6. The GitHub release will after some hours trigger an
459460
`automated conda-forge PR <https://github.com/conda-forge/pandas-feedstock/pulls>`_.

doc/source/getting_started/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ Data sets often contain more than just numerical data. pandas provides a wide ra
527527
</div>
528528
</div>
529529
</div>
530-
531530
</div>
532531
</div>
533532

doc/source/getting_started/intro_tutorials/03_subset_data.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ I’m interested in the age of the Titanic passengers.
5454
To select a single column, use square brackets ``[]`` with the column
5555
name of the column of interest.
5656

57+
For more explanation, see `Brackets in Python and pandas <https://python-public-policy.afeld.me/en/columbia/brackets.html>`__.
58+
5759
.. raw:: html
5860

5961
</li>

doc/source/reference/aliases.rst

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{{ header }}
2+
3+
.. _api.typing.aliases:
4+
5+
======================================
6+
pandas typing aliases
7+
======================================
8+
9+
**************
10+
Typing aliases
11+
**************
12+
13+
.. currentmodule:: pandas.api.typing.aliases
14+
15+
The typing declarations in ``pandas/_typing.py`` are considered private, and used
16+
by pandas developers for type checking of the pandas code base. For users, it is
17+
highly recommended to use the ``pandas-stubs`` package that represents the officially
18+
supported type declarations for users of pandas.
19+
They are documented here for users who wish to use these declarations in their
20+
own python code that calls pandas or expects certain results.
21+
22+
.. warning::
23+
24+
Note that the definitions and use cases of these aliases are subject to change without notice in any major, minor, or patch release of pandas.
25+
26+
Each of these aliases listed in the table below can be found by importing them from :py:mod:`pandas.api.typing.aliases`.
27+
28+
==================================== ================================================================
29+
Alias Meaning
30+
==================================== ================================================================
31+
:py:type:`AggFuncType` Type of functions that can be passed to :meth:`agg` methods
32+
:py:type:`AlignJoin` Argument type for ``join`` in :meth:`DataFrame.join`
33+
:py:type:`AnyAll` Argument type for ``how`` in :meth:`dropna`
34+
:py:type:`AnyArrayLike` Used to represent :class:`ExtensionArray`, ``numpy`` arrays, :class:`Index` and :class:`Series`
35+
:py:type:`ArrayLike` Used to represent :class:`ExtensionArray`, ``numpy`` arrays
36+
:py:type:`AstypeArg` Argument type in :meth:`astype`
37+
:py:type:`Axes` :py:type:`AnyArrayLike` plus sequences (not strings) and ``range``
38+
:py:type:`Axis` Argument type for ``axis`` in many methods
39+
:py:type:`CSVEngine` Argument type for ``engine`` in :meth:`DataFrame.read_csv`
40+
:py:type:`ColspaceArgType` Argument type for ``colspace`` in :meth:`DataFrame.to_html`
41+
:py:type:`CompressionOptions` Argument type for ``compression`` in all I/O output methods except :meth:`DataFrame.to_parquet`
42+
:py:type:`CorrelationMethod` Argument type for ``correlation`` in :meth:`corr`
43+
:py:type:`DropKeep` Argument type for ``keep`` in :meth:`drop_duplicates`
44+
:py:type:`Dtype` Types as objects that can be used to specify dtypes
45+
:py:type:`DtypeArg` Argument type for ``dtype`` in various methods
46+
:py:type:`DtypeBackend` Argument type for ``dtype_backend`` in various methods
47+
:py:type:`DtypeObj` Numpy dtypes and Extension dtypes
48+
:py:type:`ExcelWriterIfSheetExists` Argument type for ``if_sheet_exists`` in :class:`ExcelWriter`
49+
:py:type:`ExcelWriterMergeCells` Argument type for ``merge_cells`` in :meth:`to_excel`
50+
:py:type:`FilePath` Type of paths for files for I/O methods
51+
:py:type:`FillnaOptions` Argument type for ``method`` in various methods where NA values are filled
52+
:py:type:`FloatFormatType` Argument type for ``float_format`` in :meth:`to_string`
53+
:py:type:`FormattersType` Argument type for ``formatters`` in :meth:`to_string`
54+
:py:type:`FromDictOrient` Argument type for ``orient`` in :meth:`DataFrame.from_dict`
55+
:py:type:`HTMLFlavors` Argument type for ``flavor`` in :meth:`pandas.read_html`
56+
:py:type:`IgnoreRaise` Argument type for ``errors`` in multiple methods
57+
:py:type:`IndexLabel` Argument type for ``level`` in multiple methods
58+
:py:type:`InterpolateOptions` Argument type for ``interpolate`` in :meth:`interpolate`
59+
:py:type:`JSONEngine` Argument type for ``engine`` in :meth:`read_json`
60+
:py:type:`JSONSerializable` Argument type for the return type of a callable for argument ``default_handler`` in :meth:`to_json`
61+
:py:type:`JoinHow` Argument type for ``how`` in :meth:`pandas.merge_ordered` and for ``join`` in :meth:`Series.align`
62+
:py:type:`JoinValidate` Argument type for ``validate`` in :meth:`DataFrame.join`
63+
:py:type:`MergeHow` Argument type for ``how`` in :meth:`merge`
64+
:py:type:`MergeValidate` Argument type for ``validate`` in :meth:`merge`
65+
:py:type:`NaPosition` Argument type for ``na_position`` in :meth:`sort_index` and :meth:`sort_values`
66+
:py:type:`NsmallestNlargestKeep` Argument type for ``keep`` in :meth:`nlargest` and :meth:`nsmallest`
67+
:py:type:`OpenFileErrors` Argument type for ``errors`` in :meth:`to_hdf` and :meth:`to_csv`
68+
:py:type:`Ordered` Return type for :py:attr:`ordered`` in :class:`CategoricalDtype` and :class:`Categorical`
69+
:py:type:`ParquetCompressionOptions` Argument type for ``compression`` in :meth:`DataFrame.to_parquet`
70+
:py:type:`QuantileInterpolation` Argument type for ``interpolation`` in :meth:`quantile`
71+
:py:type:`ReadBuffer` Additional argument type corresponding to buffers for various file reading methods
72+
:py:type:`ReadCsvBuffer` Additional argument type corresponding to buffers for :meth:`pandas.read_csv`
73+
:py:type:`ReadPickleBuffer` Additional argument type corresponding to buffers for :meth:`pandas.read_pickle`
74+
:py:type:`ReindexMethod` Argument type for ``reindex`` in :meth:`reindex`
75+
:py:type:`Scalar` Types that can be stored in :class:`Series` with non-object dtype
76+
:py:type:`SequenceNotStr` Used for arguments that require sequences, but not plain strings
77+
:py:type:`SliceType` Argument types for ``start`` and ``end`` in :meth:`Index.slice_locs`
78+
:py:type:`SortKind` Argument type for ``kind`` in :meth:`sort_index` and :meth:`sort_values`
79+
:py:type:`StorageOptions` Argument type for ``storage_options`` in various file output methods
80+
:py:type:`Suffixes` Argument type for ``suffixes`` in :meth:`merge`, :meth:`compare` and :meth:`merge_ordered`
81+
:py:type:`TakeIndexer` Argument type for ``indexer`` and ``indices`` in :meth:`take`
82+
:py:type:`TimeAmbiguous` Argument type for ``ambiguous`` in time operations
83+
:py:type:`TimeGrouperOrigin` Argument type for ``origin`` in :meth:`resample` and :class:`TimeGrouper`
84+
:py:type:`TimeNonexistent` Argument type for ``nonexistent`` in time operations
85+
:py:type:`TimeUnit` Time unit argument and return type for :py:attr:`unit`, arguments ``unit`` and ``date_unit``
86+
:py:type:`TimedeltaConvertibleTypes` Argument type for ``offset`` in :meth:`resample`, ``halflife`` in :meth:`ewm` and ``start`` and ``end`` in :meth:`pandas.timedelta_range`
87+
:py:type:`TimestampConvertibleTypes` Argument type for ``origin`` in :meth:`resample` and :meth:`pandas.to_datetime`
88+
:py:type:`ToStataByteorder` Argument type for ``byteorder`` in :meth:`DataFrame.to_stata`
89+
:py:type:`ToTimestampHow` Argument type for ``how`` in :meth:`to_timestamp` and ``convention`` in :meth:`resample`
90+
:py:type:`UpdateJoin` Argument type for ``join`` in :meth:`DataFrame.update`
91+
:py:type:`UsecolsArgType` Argument type for ``usecols`` in :meth:`pandas.read_clipboard`, :meth:`pandas.read_csv` and :meth:`pandas.read_excel`
92+
:py:type:`WindowingRankType` Argument type for ``method`` in :meth:`rank`` in rolling and expanding window operations
93+
:py:type:`WriteBuffer` Additional argument type corresponding to buffers for various file output methods
94+
:py:type:`WriteExcelBuffer` Additional argument type corresponding to buffers for :meth:`to_excel`
95+
:py:type:`XMLParsers` Argument type for ``parser`` in :meth:`DataFrame.to_xml` and :meth:`pandas.read_xml`
96+
==================================== ================================================================

doc/source/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ to be stable.
5555
extensions
5656
testing
5757
missing_value
58+
aliases
5859

5960
.. This is to prevent warnings in the doc build. We don't want to encourage
6061
.. these methods.

doc/source/whatsnew/v2.3.3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ become the default string dtype in pandas 3.0. See
2222

2323
Bug fixes
2424
^^^^^^^^^
25+
- Fix bug in :meth:`Series.str.replace` using named capture groups (e.g., ``\g<name>``) with the Arrow-backed dtype would raise an error (:issue:`57636`)
2526
- Fix regression in ``~Series.str.contains``, ``~Series.str.match`` and ``~Series.str.fullmatch``
2627
with a compiled regex and custom flags (:issue:`62240`)
2728

doc/source/whatsnew/v3.0.0.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ Other enhancements
220220
- Implemented :meth:`Series.str.isascii` and :meth:`Series.str.isascii` (:issue:`59091`)
221221
- Improve the resulting dtypes in :meth:`DataFrame.where` and :meth:`DataFrame.mask` with :class:`ExtensionDtype` ``other`` (:issue:`62038`)
222222
- Improved deprecation message for offset aliases (:issue:`60820`)
223+
- Many type aliases are now exposed in the new submodule :py:mod:`pandas.api.typing.aliases` (:issue:`55231`)
223224
- Multiplying two :class:`DateOffset` objects will now raise a ``TypeError`` instead of a ``RecursionError`` (:issue:`59442`)
224225
- Restore support for reading Stata 104-format and enable reading 103-format dta files (:issue:`58554`)
225226
- Support passing a :class:`Iterable[Hashable]` input to :meth:`DataFrame.drop_duplicates` (:issue:`59237`)
226227
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
227228
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)
229+
- Switched wheel upload to **PyPI Trusted Publishing** (OIDC) for release-tag pushes in ``wheels.yml``. (:issue:`61718`)
228230
-
229231

230232
.. ---------------------------------------------------------------------------
@@ -603,6 +605,7 @@ Other API changes
603605
an empty ``RangeIndex`` or empty ``Index`` with object dtype when determining
604606
the dtype of the resulting Index (:issue:`60797`)
605607
- :class:`IncompatibleFrequency` now subclasses ``TypeError`` instead of ``ValueError``. As a result, joins with mismatched frequencies now cast to object like other non-comparable joins, and arithmetic with indexes with mismatched frequencies align (:issue:`55782`)
608+
- :meth:`CategoricalIndex.append` no longer attempts to cast different-dtype indexes to the caller's dtype (:issue:`41626`)
606609
- :meth:`ExtensionDtype.construct_array_type` is now a regular method instead of a ``classmethod`` (:issue:`58663`)
607610
- Comparison operations between :class:`Index` and :class:`Series` now consistently return :class:`Series` regardless of which object is on the left or right (:issue:`36759`)
608611
- Numpy functions like ``np.isinf`` that return a bool dtype when called on a :class:`Index` object now return a bool-dtype :class:`Index` instead of ``np.ndarray`` (:issue:`52676`)
@@ -974,8 +977,8 @@ Indexing
974977
- Bug in reindexing of :class:`DataFrame` with :class:`PeriodDtype` columns in case of consolidated block (:issue:`60980`, :issue:`60273`)
975978
- Bug in :meth:`DataFrame.loc.__getitem__` and :meth:`DataFrame.iloc.__getitem__` with a :class:`CategoricalDtype` column with integer categories raising when trying to index a row containing a ``NaN`` entry (:issue:`58954`)
976979
- Bug in :meth:`Index.__getitem__` incorrectly raising with a 0-dim ``np.ndarray`` key (:issue:`55601`)
980+
- Bug in adding new rows with :meth:`DataFrame.loc.__setitem__` or :class:`Series.loc.__setitem__` which failed to retain dtype on the object's index in some cases (:issue:`41626`)
977981
- Bug in indexing on a :class:`DatetimeIndex` with a ``timestamp[pyarrow]`` dtype or on a :class:`TimedeltaIndex` with a ``duration[pyarrow]`` dtype (:issue:`62277`)
978-
-
979982

980983
Missing
981984
^^^^^^^
@@ -1083,6 +1086,7 @@ Reshaping
10831086
- Bug in :meth:`DataFrame.join` when a :class:`DataFrame` with a :class:`MultiIndex` would raise an ``AssertionError`` when :attr:`MultiIndex.names` contained ``None``. (:issue:`58721`)
10841087
- Bug in :meth:`DataFrame.merge` where merging on a column containing only ``NaN`` values resulted in an out-of-bounds array access (:issue:`59421`)
10851088
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
1089+
- Bug in :meth:`DataFrame.unstack` raising an error with indexes containing ``NaN`` with ``sort=False`` (:issue:`61221`)
10861090
- Bug in :meth:`DataFrame.merge` when merging two :class:`DataFrame` on ``intc`` or ``uintc`` types on Windows (:issue:`60091`, :issue:`58713`)
10871091
- Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an ``index`` argument (:issue:`58722`)
10881092
- Bug in :meth:`DataFrame.pivot_table` incorrectly ignoring the ``values`` argument when also supplied to the ``index`` or ``columns`` parameters (:issue:`57876`, :issue:`61292`)
@@ -1093,7 +1097,7 @@ Reshaping
10931097
- Bug in :func:`melt` where calling with duplicate column names in ``id_vars`` raised a misleading ``AttributeError`` (:issue:`61475`)
10941098
- Bug in :meth:`DataFrame.merge` where user-provided suffixes could result in duplicate column names if the resulting names matched existing columns. Now raises a :class:`MergeError` in such cases. (:issue:`61402`)
10951099
- Bug in :meth:`DataFrame.merge` with :class:`CategoricalDtype` columns incorrectly raising ``RecursionError`` (:issue:`56376`)
1096-
-
1100+
- Bug in :meth:`DataFrame.merge` with a ``float32`` index incorrectly casting the index to ``float64`` (:issue:`41626`)
10971101

10981102
Sparse
10991103
^^^^^^
@@ -1158,6 +1162,7 @@ Other
11581162
- Bug in printing a :class:`DataFrame` with a :class:`DataFrame` stored in :attr:`DataFrame.attrs` raised a ``ValueError`` (:issue:`60455`)
11591163
- Bug in printing a :class:`Series` with a :class:`DataFrame` stored in :attr:`Series.attrs` raised a ``ValueError`` (:issue:`60568`)
11601164
- Deprecated the keyword ``check_datetimelike_compat`` in :meth:`testing.assert_frame_equal` and :meth:`testing.assert_series_equal` (:issue:`55638`)
1165+
- Fixed bug in the :meth:`Series.rank` with object dtype and extremely small float values (:issue:`62036`)
11611166
- Fixed bug where the :class:`DataFrame` constructor misclassified array-like objects with a ``.name`` attribute as :class:`Series` or :class:`Index` (:issue:`61443`)
11621167
- Fixed regression in :meth:`DataFrame.from_records` not initializing subclasses properly (:issue:`57008`)
11631168
-

0 commit comments

Comments
 (0)