Skip to content

Commit e8b2c8c

Browse files
authored
Merge branch 'main' into deps/pytz/optional
2 parents d15f8e1 + ecea7c3 commit e8b2c8c

File tree

78 files changed

+890
-260
lines changed

Some content is hidden

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

78 files changed

+890
-260
lines changed

.gitattributes

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ci export-ignore
6868
doc export-ignore
6969
gitpod export-ignore
7070
MANIFEST.in export-ignore
71-
scripts export-ignore
71+
scripts/** export-ignore
7272
typings export-ignore
7373
web export-ignore
7474
CITATION.cff export-ignore
@@ -82,3 +82,7 @@ setup.py export-ignore
8282
# csv_dir_path fixture checks the existence of the directory
8383
# exclude the whole directory to avoid running related tests in sdist
8484
pandas/tests/io/parser/data export-ignore
85+
86+
# Include cibw script in sdist since it's needed for building wheels
87+
scripts/cibw_before_build.sh -export-ignore
88+
scripts/cibw_before_test.sh -export-ignore

.github/workflows/wheels.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,25 @@ jobs:
9999
- [macos-14, macosx_arm64]
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102-
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
103-
102+
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"]]
103+
include:
104+
# TODO: Remove this plus installing build deps in cibw_before_build.sh
105+
# and test deps in cibw_before_test.sh after pandas can be built with a released NumPy/Cython
106+
- python: ["cp313", "3.13"]
107+
cibw_build_frontend: 'pip; args: --no-build-isolation'
108+
- python: ["cp313t", "3.13"]
109+
cibw_build_frontend: 'pip; args: --no-build-isolation'
104110
# Build Pyodide wheels and upload them to Anaconda.org
105111
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
106112
# that it uses cibuildwheel instead of a standard Pyodide xbuildenv setup.
107-
include:
108-
- buildplat: [ubuntu-22.04, pyodide_wasm32]
109-
python: ["cp312", "3.12"]
113+
- buildplat: [ubuntu-22.04, pyodide_wasm32]
114+
python: ["cp312", "3.12"]
115+
cibw_build_frontend: 'build'
116+
# TODO: Build free-threaded wheels for Windows
117+
exclude:
118+
- buildplat: [windows-2022, win_amd64]
119+
python: ["cp313t", "3.13"]
120+
110121
env:
111122
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
112123
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -153,6 +164,7 @@ jobs:
153164
env:
154165
CIBW_PRERELEASE_PYTHONS: True
155166
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
167+
CIBW_BUILD_FRONTEND: ${{ matrix.cibw_build_frontend || 'pip' }}
156168
CIBW_PLATFORM: ${{ matrix.buildplat[1] == 'pyodide_wasm32' && 'pyodide' || 'auto' }}
157169

158170
- name: Set up Python
@@ -176,15 +188,17 @@ jobs:
176188
- name: Test Windows Wheels
177189
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
178190
shell: pwsh
191+
# TODO: Remove NumPy nightly install when there's a 3.13 wheel on PyPI
179192
run: |
180193
$TST_CMD = @"
181194
python -m pip install hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0;
195+
${{ matrix.python[1] == '3.13' && 'python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy;' }}
182196
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
183197
python -c `'import pandas as pd; pd.test(extra_args=[`\"--no-strict-data-files`\", `\"-m not clipboard and not single_cpu and not slow and not network and not db`\"])`';
184198
"@
185199
# add rc to the end of the image name if the Python version is unreleased
186-
docker pull python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
187-
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] == '3.12' && '3.12-rc' || format('{0}-windowsservercore', matrix.python[1]) }} powershell -Command $TST_CMD
200+
docker pull python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }}
201+
docker run --env PANDAS_CI='1' -v ${PWD}:C:\pandas python:${{ matrix.python[1] == '3.13' && '3.13-rc' || format('{0}-windowsservercore', matrix.python[1]) }} powershell -Command $TST_CMD
188202
189203
- uses: actions/upload-artifact@v4
190204
with:

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ prune pandas/tests/io/parser/data
6262
# Selectively re-add *.cxx files that were excluded above
6363
graft pandas/_libs/src
6464
graft pandas/_libs/include
65+
66+
# Include cibw script in sdist since it's needed for building wheels
67+
include scripts/cibw_before_build.sh
68+
include scripts/cibw_before_test.sh

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
304304
-i "pandas.api.types.is_re PR07,SA01" \
305305
-i "pandas.api.types.is_re_compilable PR07,SA01" \
306306
-i "pandas.api.types.is_sparse SA01" \
307-
-i "pandas.api.types.is_string_dtype SA01" \
308307
-i "pandas.api.types.is_timedelta64_ns_dtype SA01" \
309308
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
310309
-i "pandas.api.types.union_categoricals RT03,SA01" \

doc/source/getting_started/comparison/comparison_with_sql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ DELETE
505505
DELETE FROM tips
506506
WHERE tip > 9;
507507
508-
In pandas we select the rows that should remain instead of deleting them:
508+
In pandas we select the rows that should remain instead of deleting the rows that should be removed:
509509

510510
.. ipython:: python
511511

doc/source/user_guide/pyarrow.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ PyArrow also provides IO reading functionality that has been integrated into sev
159159
functions provide an ``engine`` keyword that can dispatch to PyArrow to accelerate reading from an IO source.
160160

161161
* :func:`read_csv`
162+
* :func:`read_feather`
162163
* :func:`read_json`
163164
* :func:`read_orc`
164-
* :func:`read_feather`
165+
* :func:`read_parquet`
166+
* :func:`read_table` (experimental)
165167

166168
.. ipython:: python
167169

doc/source/whatsnew/v3.0.0.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Other enhancements
3333
- :func:`DataFrame.to_excel` now raises an ``UserWarning`` when the character count in a cell exceeds Excel's limitation of 32767 characters (:issue:`56954`)
3434
- :func:`read_stata` now returns ``datetime64`` resolutions better matching those natively stored in the stata format (:issue:`55642`)
3535
- :meth:`DataFrame.agg` called with ``axis=1`` and a ``func`` which relabels the result index now raises a ``NotImplementedError`` (:issue:`58807`).
36+
- :meth:`Index.get_loc` now accepts also subclasses of ``tuple`` as keys (:issue:`57922`)
3637
- :meth:`Styler.set_tooltips` provides alternative method to storing tooltips by using title attribute of td elements. (:issue:`56981`)
3738
- Allow dictionaries to be passed to :meth:`pandas.Series.str.replace` via ``pat`` parameter (:issue:`51748`)
3839
- Support passing a :class:`Series` input to :func:`json_normalize` that retains the :class:`Series` :class:`Index` (:issue:`51452`)
@@ -49,6 +50,7 @@ Other enhancements
4950
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
5051
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
5152
- Restore support for reading Stata 104-format and enable reading 103-format dta files (:issue:`58554`)
53+
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
5254
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)
5355

5456
.. ---------------------------------------------------------------------------
@@ -264,8 +266,10 @@ Other API changes
264266
^^^^^^^^^^^^^^^^^
265267
- 3rd party ``py.path`` objects are no longer explicitly supported in IO methods. Use :py:class:`pathlib.Path` objects instead (:issue:`57091`)
266268
- :func:`read_table`'s ``parse_dates`` argument defaults to ``None`` to improve consistency with :func:`read_csv` (:issue:`57476`)
269+
- All classes inheriting from builtin ``tuple`` (including types created with :func:`collections.namedtuple`) are now hashed and compared as builtin ``tuple`` during indexing operations (:issue:`57922`)
267270
- Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`)
268271
- Passing a :class:`Series` input to :func:`json_normalize` will now retain the :class:`Series` :class:`Index`, previously output had a new :class:`RangeIndex` (:issue:`51452`)
272+
- Removed :meth:`Index.sort` which always raised a ``TypeError``. This attribute is not defined and will raise an ``AttributeError`` (:issue:`59283`)
269273
- Updated :meth:`DataFrame.to_excel` so that the output spreadsheet has no styling. Custom styling can still be done using :meth:`Styler.to_excel` (:issue:`54154`)
270274
- pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`)
271275
- pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`)
@@ -313,6 +317,7 @@ Other Deprecations
313317
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.all`, :meth:`DataFrame.min`, :meth:`DataFrame.max`, :meth:`DataFrame.sum`, :meth:`DataFrame.prod`, :meth:`DataFrame.mean`, :meth:`DataFrame.median`, :meth:`DataFrame.sem`, :meth:`DataFrame.var`, :meth:`DataFrame.std`, :meth:`DataFrame.skew`, :meth:`DataFrame.kurt`, :meth:`Series.all`, :meth:`Series.min`, :meth:`Series.max`, :meth:`Series.sum`, :meth:`Series.prod`, :meth:`Series.mean`, :meth:`Series.median`, :meth:`Series.sem`, :meth:`Series.var`, :meth:`Series.std`, :meth:`Series.skew`, and :meth:`Series.kurt`. (:issue:`57087`)
314318
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except ``buf``. (:issue:`57280`)
315319
- Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except ``buf``. (:issue:`57280`)
320+
- Deprecated behavior of :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupBy.groups`, in a future version ``groups`` by one element list will return tuple instead of scalar. (:issue:`58858`)
316321
- Deprecated behavior of :meth:`Series.dt.to_pytimedelta`, in a future version this will return a :class:`Series` containing python ``datetime.timedelta`` objects instead of an ``ndarray`` of timedelta; this matches the behavior of other :meth:`Series.dt` properties. (:issue:`57463`)
317322
- Deprecated lowercase strings ``d``, ``b`` and ``c`` denoting frequencies in :class:`Day`, :class:`BusinessDay` and :class:`CustomBusinessDay` in favour of ``D``, ``B`` and ``C`` (:issue:`58998`)
318323
- Deprecated lowercase strings ``w``, ``w-mon``, ``w-tue``, etc. denoting frequencies in :class:`Week` in favour of ``W``, ``W-MON``, ``W-TUE``, etc. (:issue:`58998`)

pandas/_libs/include/pandas/vendored/klib/khash_python.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ static inline int pyobject_cmp(PyObject *a, PyObject *b) {
207207
if (PyComplex_CheckExact(a)) {
208208
return complexobject_cmp((PyComplexObject *)a, (PyComplexObject *)b);
209209
}
210-
if (PyTuple_CheckExact(a)) {
210+
if (PyTuple_Check(a)) {
211+
// compare tuple subclasses as builtin tuples
211212
return tupleobject_cmp((PyTupleObject *)a, (PyTupleObject *)b);
212213
}
213214
// frozenset isn't yet supported
@@ -311,7 +312,8 @@ static inline khuint32_t kh_python_hash_func(PyObject *key) {
311312
// because complex(k,0) == k holds for any int-object k
312313
// and kh_complex128_hash_func doesn't respect it
313314
hash = complexobject_hash((PyComplexObject *)key);
314-
} else if (PyTuple_CheckExact(key)) {
315+
} else if (PyTuple_Check(key)) {
316+
// hash tuple subclasses as builtin tuples
315317
hash = tupleobject_hash((PyTupleObject *)key);
316318
} else {
317319
hash = PyObject_Hash(key);

pandas/core/apply.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -486,20 +486,14 @@ def compute_dict_like(
486486
cols = df[key]
487487

488488
if cols.ndim == 1:
489-
series_list = [obj._gotitem(key, ndim=1, subset=cols)]
489+
series = obj._gotitem(key, ndim=1, subset=cols)
490+
results.append(getattr(series, op_name)(how, **kwargs))
491+
keys.append(key)
490492
else:
491-
series_list = []
492-
for index in range(cols.shape[1]):
493-
col = cols.iloc[:, index]
494-
493+
for _, col in cols.items():
495494
series = obj._gotitem(key, ndim=1, subset=col)
496-
series_list.append(series)
497-
498-
for series in series_list:
499-
result = getattr(series, op_name)(how, **kwargs)
500-
results.append(result)
501-
keys.append(key)
502-
495+
results.append(getattr(series, op_name)(how, **kwargs))
496+
keys.append(key)
503497
else:
504498
results = [
505499
getattr(obj._gotitem(key, ndim=1), op_name)(how, **kwargs)

pandas/core/dtypes/common.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@ def is_string_dtype(arr_or_dtype) -> bool:
558558
boolean
559559
Whether or not the array or dtype is of the string dtype.
560560
561+
See Also
562+
--------
563+
api.types.is_string_dtype : Check whether the provided array or dtype
564+
is of the string dtype.
565+
561566
Examples
562567
--------
563568
>>> from pandas.api.types import is_string_dtype

0 commit comments

Comments
 (0)