Skip to content

Commit 26b81c3

Browse files
Merge branch 'main' into issue61675
2 parents 1a3bee7 + 9f4c0ba commit 26b81c3

File tree

83 files changed

+3126
-1170
lines changed

Some content is hidden

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

83 files changed

+3126
-1170
lines changed

.github/workflows/docbuild-and-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
run: mv doc/build/html web/build/docs
9494

9595
- name: Save website as an artifact
96-
uses: actions/upload-artifact@v4
96+
uses: actions/upload-artifact@v5
9797
with:
9898
name: website
9999
path: web/build

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ jobs:
181181
timeout-minutes: 90
182182
strategy:
183183
matrix:
184-
# Note: Don't use macOS latest since macos 14 appears to be arm64 only
185-
os: [macos-13, macos-14, windows-2025]
184+
os: [macos-15-intel, macos-15, windows-2025]
186185
env_file: [actions-311.yaml, actions-312.yaml, actions-313.yaml]
187186
fail-fast: false
188187
runs-on: ${{ matrix.os }}

.github/workflows/wheels.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
python -m pip install build
6565
python -m build --sdist
6666
67-
- uses: actions/upload-artifact@v4
67+
- uses: actions/upload-artifact@v5
6868
with:
6969
name: sdist
7070
path: ./dist/*
@@ -98,10 +98,9 @@ jobs:
9898
- [ubuntu-24.04, musllinux_x86_64]
9999
- [ubuntu-24.04-arm, manylinux_aarch64]
100100
- [ubuntu-24.04-arm, musllinux_aarch64]
101-
- [macos-13, macosx_x86_64]
102-
# Note: M1 images on Github Actions start from macOS 14
103-
- [macos-14, macosx_arm64]
104-
- [windows-2022, win_amd64]
101+
- [macos-15-intel, macosx_x86_64]
102+
- [macos-15, macosx_arm64]
103+
- [windows-2025, win_amd64]
105104
- [windows-11-arm, win_arm64]
106105
python: [["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"], ["cp314", "3.14"], ["cp314t", "3.14"]]
107106
include:
@@ -139,7 +138,7 @@ jobs:
139138
# removes unnecessary files from the release
140139
- name: Download sdist (not macOS)
141140
#if: ${{ matrix.buildplat[1] != 'macosx_*' }}
142-
uses: actions/download-artifact@v5
141+
uses: actions/download-artifact@v6
143142
with:
144143
name: sdist
145144
path: ./dist
@@ -197,7 +196,7 @@ jobs:
197196
shell: bash -el {0}
198197
run: for whl in $(ls wheelhouse); do wheel unpack wheelhouse/$whl -d /tmp; done
199198

200-
- uses: actions/upload-artifact@v4
199+
- uses: actions/upload-artifact@v5
201200
with:
202201
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
203202
path: ./wheelhouse/*.whl
@@ -239,11 +238,11 @@ jobs:
239238

240239
steps:
241240
- name: Download all artefacts
242-
uses: actions/download-artifact@v5
241+
uses: actions/download-artifact@v6
243242
with:
244243
path: dist # everything lands in ./dist/**
245244

246-
# TODO: This step can be probably be achieved by actions/download-artifact@v5
245+
# TODO: This step can be probably be achieved by actions/download-artifact@v6
247246
# by specifying merge-multiple: true, and a glob pattern
248247
- name: Collect files
249248
run: |

asv_bench/benchmarks/ctors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def gen_of_str(arr):
2323

2424

2525
def arr_dict(arr):
26-
return dict(zip(range(len(arr)), arr))
26+
return dict(zip(range(len(arr)), arr, strict=True))
2727

2828

2929
def list_of_tuples(arr):

asv_bench/benchmarks/series_methods.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def setup(self):
1616
self.idx = date_range(
1717
start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
1818
)
19-
self.data = dict(zip(self.idx, range(len(self.idx))))
19+
self.data = dict(zip(self.idx, range(len(self.idx)), strict=True))
2020
self.array = np.array([1, 2, 3])
2121
self.idx2 = Index(["a", "b", "c"])
2222

@@ -407,7 +407,9 @@ def setup(self, num_to_replace):
407407
self.to_replace_list = np.random.choice(self.arr, num_to_replace)
408408
self.values_list = np.random.choice(self.arr1, num_to_replace)
409409

410-
self.replace_dict = dict(zip(self.to_replace_list, self.values_list))
410+
self.replace_dict = dict(
411+
zip(self.to_replace_list, self.values_list, strict=True)
412+
)
411413

412414
def time_replace_dict(self, num_to_replace):
413415
self.ser.replace(self.replace_dict)

doc/source/reference/aliases.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Alias Meaning
6565
:py:type:`NaPosition` Argument type for ``na_position`` in :meth:`sort_index` and :meth:`sort_values`
6666
:py:type:`NsmallestNlargestKeep` Argument type for ``keep`` in :meth:`nlargest` and :meth:`nsmallest`
6767
: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`
68+
:py:type:`Ordered` Return type for :py:attr:`ordered` in :class:`CategoricalDtype` and :class:`Categorical`
6969
:py:type:`ParquetCompressionOptions` Argument type for ``compression`` in :meth:`DataFrame.to_parquet`
7070
:py:type:`QuantileInterpolation` Argument type for ``interpolation`` in :meth:`quantile`
7171
:py:type:`ReadBuffer` Additional argument type corresponding to buffers for various file reading methods
@@ -89,7 +89,7 @@ Alias Meaning
8989
:py:type:`ToTimestampHow` Argument type for ``how`` in :meth:`to_timestamp` and ``convention`` in :meth:`resample`
9090
:py:type:`UpdateJoin` Argument type for ``join`` in :meth:`DataFrame.update`
9191
: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
92+
:py:type:`WindowingRankType` Argument type for ``method`` in :meth:`rank` in rolling and expanding window operations
9393
:py:type:`WriteBuffer` Additional argument type corresponding to buffers for various file output methods
9494
:py:type:`WriteExcelBuffer` Additional argument type corresponding to buffers for :meth:`to_excel`
9595
:py:type:`XMLParsers` Argument type for ``parser`` in :meth:`DataFrame.to_xml` and :meth:`pandas.read_xml`

doc/source/user_guide/io.rst

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2366,52 +2366,7 @@ Read a URL with no options:
23662366

23672367
The data from the above URL changes every Monday so the resulting data above may be slightly different.
23682368

2369-
Read a URL while passing headers alongside the HTTP request:
2370-
2371-
.. code-block:: ipython
2372-
2373-
In [322]: url = 'https://www.sump.org/notes/request/' # HTTP request reflector
2374-
2375-
In [323]: pd.read_html(url)
2376-
Out[323]:
2377-
[ 0 1
2378-
0 Remote Socket: 51.15.105.256:51760
2379-
1 Protocol Version: HTTP/1.1
2380-
2 Request Method: GET
2381-
3 Request URI: /notes/request/
2382-
4 Request Query: NaN,
2383-
0 Accept-Encoding: identity
2384-
1 Host: www.sump.org
2385-
2 User-Agent: Python-urllib/3.8
2386-
3 Connection: close]
2387-
2388-
In [324]: headers = {
2389-
.....: 'User-Agent':'Mozilla Firefox v14.0',
2390-
.....: 'Accept':'application/json',
2391-
.....: 'Connection':'keep-alive',
2392-
.....: 'Auth':'Bearer 2*/f3+fe68df*4'
2393-
.....: }
2394-
2395-
In [325]: pd.read_html(url, storage_options=headers)
2396-
Out[325]:
2397-
[ 0 1
2398-
0 Remote Socket: 51.15.105.256:51760
2399-
1 Protocol Version: HTTP/1.1
2400-
2 Request Method: GET
2401-
3 Request URI: /notes/request/
2402-
4 Request Query: NaN,
2403-
0 User-Agent: Mozilla Firefox v14.0
2404-
1 AcceptEncoding: gzip, deflate, br
2405-
2 Accept: application/json
2406-
3 Connection: keep-alive
2407-
4 Auth: Bearer 2*/f3+fe68df*4]
2408-
2409-
.. note::
2410-
2411-
We see above that the headers we passed are reflected in the HTTP request.
2412-
2413-
Read in the content of the file from the above URL and pass it to ``read_html``
2414-
as a string:
2369+
Read in HTML content from a file using ``read_html``:
24152370

24162371
.. ipython:: python
24172372

doc/source/whatsnew/v3.0.0.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ Other enhancements
201201
- :class:`Rolling` and :class:`Expanding` now support ``nunique`` (:issue:`26958`)
202202
- :class:`Rolling` and :class:`Expanding` now support aggregations ``first`` and ``last`` (:issue:`33155`)
203203
- :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`)
204+
- :func:`to_numeric` on big integers converts to ``object`` datatype with python integers when not coercing. (:issue:`51295`)
204205
- :meth:`.DataFrameGroupBy.transform`, :meth:`.SeriesGroupBy.transform`, :meth:`.DataFrameGroupBy.agg`, :meth:`.SeriesGroupBy.agg`, :meth:`.SeriesGroupBy.apply`, :meth:`.DataFrameGroupBy.apply` now support ``kurt`` (:issue:`40139`)
205206
- :meth:`DataFrame.apply` supports using third-party execution engines like the Bodo.ai JIT compiler (:issue:`60668`)
206207
- :meth:`DataFrame.iloc` and :meth:`Series.iloc` now support boolean masks in ``__getitem__`` for more consistent indexing behavior (:issue:`60994`)
@@ -219,6 +220,7 @@ Other enhancements
219220
- Added support to read and write from and to Apache Iceberg tables with the new :func:`read_iceberg` and :meth:`DataFrame.to_iceberg` functions (:issue:`61383`)
220221
- Errors occurring during SQL I/O will now throw a generic :class:`.DatabaseError` instead of the raw Exception type from the underlying driver manager library (:issue:`60748`)
221222
- Implemented :meth:`Series.str.isascii` and :meth:`Series.str.isascii` (:issue:`59091`)
223+
- Improve error reporting through outputting the first few duplicates when :func:`merge` validation fails (:issue:`62742`)
222224
- Improve the resulting dtypes in :meth:`DataFrame.where` and :meth:`DataFrame.mask` with :class:`ExtensionDtype` ``other`` (:issue:`62038`)
223225
- Improved deprecation message for offset aliases (:issue:`60820`)
224226
- Many type aliases are now exposed in the new submodule :py:mod:`pandas.api.typing.aliases` (:issue:`55231`)
@@ -515,6 +517,22 @@ If we had passed ``pd.Int64Dtype()`` or ``"int64[pyarrow]"`` for the dtype in th
515517

516518
With ``"mode.nan_is_na"`` set to ``False``, ``ser.to_numpy()`` (and ``frame.values`` and ``np.asarray(obj)``) will convert to ``object`` dtype if :class:`NA` entries are present, where before they would coerce to ``NaN``. To retain a float numpy dtype, explicitly pass ``na_value=np.nan`` to :meth:`Series.to_numpy`.
517519

520+
The ``__module__`` attribute now points to public modules
521+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
522+
523+
The ``__module__`` attribute on functions and classes in the public API has been
524+
updated to refer to the preferred public module from which to access the object,
525+
rather than the module in which the object happens to be defined (:issue:`55178`).
526+
527+
This produces more informative displays in the Python console for classes, e.g.,
528+
instead of ``<class 'pandas.core.frame.DataFrame'>`` you now see
529+
``<class 'pandas.DataFrame'>``, and in interactive tools such as IPython, e.g.,
530+
instead of ``<function pandas.io.parsers.readers.read_csv(...)>`` you now see
531+
``<function pandas.read_csv(...)>``.
532+
533+
This may break code that relies on the previous ``__module__`` values (e.g.
534+
doctests inspecting the ``type()`` of a DataFrame object).
535+
518536
.. _whatsnew_300.api_breaking.deps:
519537

520538
Increased minimum version for Python
@@ -720,6 +738,7 @@ Other Deprecations
720738
- Deprecated backward-compatibility behavior for :meth:`DataFrame.select_dtypes` matching "str" dtype when ``np.object_`` is specified (:issue:`61916`)
721739
- Deprecated option "future.no_silent_downcasting", as it is no longer used. In a future version accessing this option will raise (:issue:`59502`)
722740
- Deprecated slicing on a :class:`Series` or :class:`DataFrame` with a :class:`DatetimeIndex` using a ``datetime.date`` object, explicitly cast to :class:`Timestamp` instead (:issue:`35830`)
741+
- Deprecated the 'inplace' keyword from :meth:`Resampler.interpolate`, as passing ``True`` raises ``AttributeError`` (:issue:`58690`)
723742

724743
.. ---------------------------------------------------------------------------
725744
.. _whatsnew_300.prior_deprecations:
@@ -938,6 +957,7 @@ Bug fixes
938957

939958
Categorical
940959
^^^^^^^^^^^
960+
- Bug in :class:`Categorical` where constructing from a pandas :class:`Series` or :class:`Index` with ``dtype='object'`` did not preserve the categories' dtype as ``object``; now the ``categories.dtype`` is preserved as ``object`` for these cases, while numpy arrays and Python sequences with ``dtype='object'`` continue to infer the most specific dtype (for example, ``str`` if all elements are strings) (:issue:`61778`)
941961
- Bug in :func:`Series.apply` where ``nan`` was ignored for :class:`CategoricalDtype` (:issue:`59938`)
942962
- Bug in :func:`testing.assert_index_equal` raising ``TypeError`` instead of ``AssertionError`` for incomparable ``CategoricalIndex`` when ``check_categorical=True`` and ``exact=False`` (:issue:`61935`)
943963
- Bug in :meth:`Categorical.astype` where ``copy=False`` would still trigger a copy of the codes (:issue:`62000`)
@@ -962,6 +982,7 @@ Datetimelike
962982
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
963983
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning ``False`` on double-digit frequencies (:issue:`58523`)
964984
- Bug in :meth:`DatetimeIndex.union` and :meth:`DatetimeIndex.intersection` when ``unit`` was non-nanosecond (:issue:`59036`)
985+
- Bug in :meth:`DatetimeIndex.where` and :meth:`TimedeltaIndex.where` failing to set ``freq=None`` in some cases (:issue:`24555`)
965986
- Bug in :meth:`Index.union` with a ``pyarrow`` timestamp dtype incorrectly returning ``object`` dtype (:issue:`58421`)
966987
- Bug in :meth:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
967988
- Bug in :meth:`Timestamp.normalize` and :meth:`DatetimeArray.normalize` returning incorrect results instead of raising on integer overflow for very small (distant past) values (:issue:`60583`)
@@ -978,7 +999,6 @@ Datetimelike
978999
- Bug in constructing arrays with a timezone-aware :class:`ArrowDtype` from timezone-naive datetime objects incorrectly treating those as UTC times instead of wall times like :class:`DatetimeTZDtype` (:issue:`61775`)
9791000
- Bug in setting scalar values with mismatched resolution into arrays with non-nanosecond ``datetime64``, ``timedelta64`` or :class:`DatetimeTZDtype` incorrectly truncating those scalars (:issue:`56410`)
9801001

981-
9821002
Timedelta
9831003
^^^^^^^^^
9841004
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`)
@@ -997,6 +1017,7 @@ Numeric
9971017
^^^^^^^
9981018
- Bug in :func:`api.types.infer_dtype` returning "mixed" for complex and ``pd.NA`` mix (:issue:`61976`)
9991019
- Bug in :func:`api.types.infer_dtype` returning "mixed-integer-float" for float and ``pd.NA`` mix (:issue:`61621`)
1020+
- Bug in :meth:`DataFrame.combine_first` where Int64 and UInt64 integers with absolute value greater than ``2**53`` would lose precision after the operation. (:issue:`60128`)
10001021
- Bug in :meth:`DataFrame.corr` where numerical precision errors resulted in correlations above ``1.0`` (:issue:`61120`)
10011022
- Bug in :meth:`DataFrame.cov` raises a ``TypeError`` instead of returning potentially incorrect results or other errors (:issue:`53115`)
10021023
- Bug in :meth:`DataFrame.quantile` where the column type was not preserved when ``numeric_only=True`` with a list-like ``q`` produced an empty result (:issue:`59035`)
@@ -1016,6 +1037,7 @@ Conversion
10161037

10171038
Strings
10181039
^^^^^^^
1040+
- Bug in :meth:`Series.str.replace` raising an error on valid group references (``\1``, ``\2``, etc.) on series converted to PyArrow backend dtype (:issue:`62653`)
10191041
- Bug in :meth:`Series.str.zfill` raising ``AttributeError`` for :class:`ArrowDtype` (:issue:`61485`)
10201042
- Bug in :meth:`Series.value_counts` would not respect ``sort=False`` for series having ``string`` dtype (:issue:`55224`)
10211043
- Bug in multiplication with a :class:`StringDtype` incorrectly allowing multiplying by bools; explicitly cast to integers instead (:issue:`62595`)
@@ -1025,6 +1047,7 @@ Interval
10251047
- :meth:`Index.is_monotonic_decreasing`, :meth:`Index.is_monotonic_increasing`, and :meth:`Index.is_unique` could incorrectly be ``False`` for an ``Index`` created from a slice of another ``Index``. (:issue:`57911`)
10261048
- Bug in :class:`Index`, :class:`Series`, :class:`DataFrame` constructors when given a sequence of :class:`Interval` subclass objects casting them to :class:`Interval` (:issue:`46945`)
10271049
- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
1050+
- Bug in :meth:`IntervalIndex.get_indexer` and :meth:`IntervalIndex.drop` when one of the sides of the index is non-unique (:issue:`52245`)
10281051

10291052
Indexing
10301053
^^^^^^^^
@@ -1091,7 +1114,7 @@ I/O
10911114
- Bug in :meth:`read_csv` raising ``TypeError`` when ``index_col`` is specified and ``na_values`` is a dict containing the key ``None``. (:issue:`57547`)
10921115
- Bug in :meth:`read_csv` raising ``TypeError`` when ``nrows`` and ``iterator`` are specified without specifying a ``chunksize``. (:issue:`59079`)
10931116
- Bug in :meth:`read_csv` where the order of the ``na_values`` makes an inconsistency when ``na_values`` is a list non-string values. (:issue:`59303`)
1094-
- Bug in :meth:`read_csv` with ``engine="c"`` reading big integers as strings. Now reads them as python integers. (:issue:`51295`)
1117+
- Bug in :meth:`read_csv` with ``c`` and ``python`` engines reading big integers as strings. Now reads them as python integers. (:issue:`51295`)
10951118
- Bug in :meth:`read_csv` with ``engine="c"`` reading large float numbers with preceding integers as strings. Now reads them as floats. (:issue:`51295`)
10961119
- Bug in :meth:`read_csv` with ``engine="pyarrow"`` and ``dtype="Int64"`` losing precision (:issue:`56136`)
10971120
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
@@ -1131,6 +1154,7 @@ Groupby/resample/rolling
11311154
- Bug in :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupby.groups` that would not respect groupby argument ``dropna`` (:issue:`55919`)
11321155
- Bug in :meth:`.DataFrameGroupBy.median` where nat values gave an incorrect result. (:issue:`57926`)
11331156
- Bug in :meth:`.DataFrameGroupBy.quantile` when ``interpolation="nearest"`` is inconsistent with :meth:`DataFrame.quantile` (:issue:`47942`)
1157+
- Bug in :meth:`.DataFrameGroupBy` reductions where non-Boolean values were allowed for the ``numeric_only`` argument; passing a non-Boolean value will now raise (:issue:`62778`)
11341158
- Bug in :meth:`.Resampler.interpolate` on a :class:`DataFrame` with non-uniform sampling and/or indices not aligning with the resulting resampled index would result in wrong interpolation (:issue:`21351`)
11351159
- Bug in :meth:`.Series.rolling` when used with a :class:`.BaseIndexer` subclass and computing min/max (:issue:`46726`)
11361160
- Bug in :meth:`DataFrame.ewm` and :meth:`Series.ewm` when passed ``times`` and aggregation functions other than mean (:issue:`51695`)
@@ -1187,6 +1211,7 @@ ExtensionArray
11871211
- Bug in comparison between object with :class:`ArrowDtype` and incompatible-dtyped (e.g. string vs bool) incorrectly raising instead of returning all-``False`` (for ``==``) or all-``True`` (for ``!=``) (:issue:`59505`)
11881212
- Bug in constructing pandas data structures when passing into ``dtype`` a string of the type followed by ``[pyarrow]`` while PyArrow is not installed would raise ``NameError`` rather than ``ImportError`` (:issue:`57928`)
11891213
- Bug in various :class:`DataFrame` reductions for pyarrow temporal dtypes returning incorrect dtype when result was null (:issue:`59234`)
1214+
- Fixed flex arithmetic with :class:`ExtensionArray` operands raising when ``fill_value`` was passed. (:issue:`62467`)
11901215

11911216
Styler
11921217
^^^^^^

pandas/_config/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,3 +944,11 @@ def is_callable(obj: object) -> bool:
944944
if not callable(obj):
945945
raise ValueError("Value must be a callable")
946946
return True
947+
948+
949+
# import set_module here would cause circular import
950+
get_option.__module__ = "pandas"
951+
set_option.__module__ = "pandas"
952+
describe_option.__module__ = "pandas"
953+
reset_option.__module__ = "pandas"
954+
option_context.__module__ = "pandas"

0 commit comments

Comments
 (0)