Skip to content

Commit 43adb44

Browse files
authored
Merge branch 'main' into patch-4
2 parents 4942bac + 2d6c51f commit 43adb44

Some content is hidden

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

58 files changed

+1335
-185
lines changed

.github/workflows/wheels.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0')))
4646
runs-on: ubuntu-24.04
4747
env:
48+
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
4849
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
4950
outputs:
5051
sdist_file: ${{ steps.save-path.outputs.sdist_name }}
@@ -117,6 +118,7 @@ jobs:
117118
python: ["cp313t", "3.13"]
118119

119120
env:
121+
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
120122
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
121123
steps:
122124
- name: Checkout pandas
@@ -164,7 +166,6 @@ jobs:
164166
uses: pypa/cibuildwheel@v3.2.1
165167
with:
166168
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
167-
output-dir: ./dist
168169
env:
169170
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
170171
CIBW_BUILD_FRONTEND: ${{ matrix.cibw_build_frontend || 'pip' }}
@@ -195,19 +196,26 @@ jobs:
195196

196197
- name: Validate wheel RECORD
197198
shell: bash -el {0}
198-
run: for whl in $(ls ./dist/*.whl); do wheel unpack $whl -d /tmp; done
199+
run: for whl in $(ls wheelhouse); do wheel unpack wheelhouse/$whl -d /tmp; done
199200

200201
- uses: actions/upload-artifact@v6
201202
with:
202203
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
203-
path: ./dist/*.whl
204+
path: ./wheelhouse/*.whl
204205

205206
- name: Upload wheels & sdist
206-
if: ${{ success() && env.IS_SCHEDULE_DISPATCH == 'true' }}
207-
uses: scientific-python/upload-nightly-action@0.6.2
208-
with:
209-
artifacts_path: ./dist
210-
anaconda_nightly_upload_token: ${{secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN}}
207+
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
208+
shell: bash -el {0}
209+
env:
210+
PANDAS_NIGHTLY_UPLOAD_TOKEN: ${{ secrets.PANDAS_NIGHTLY_UPLOAD_TOKEN }}
211+
# trigger an upload to
212+
# https://anaconda.org/scientific-python-nightly-wheels/pandas
213+
# for cron jobs or "Run workflow" (restricted to main branch).
214+
# The tokens were originally generated at anaconda.org
215+
run: |
216+
source ci/upload_wheels.sh
217+
set_upload_vars
218+
upload_wheels
211219
212220
publish:
213221
if: >

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pandas/py.typed
6767
.ropeproject
6868
# wheel files
6969
*.whl
70+
**/wheelhouse/*
7071
pip-wheel-metadata
7172
# coverage
7273
.coverage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ details, see the commit logs at https://github.com/pandas-dev/pandas.
115115
## Dependencies
116116
- [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org)
117117
- [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html)
118-
- [tzdata - Provides an IANA time zone database](https://tzdata.readthedocs.io/en/latest/)
118+
- [tzdata - Provides an IANA time zone database](https://tzdata.readthedocs.io/en/latest/) (Only required on Windows/Emscripten)
119119

120120
See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies.
121121

ci/upload_wheels.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Modified from numpy's https://github.com/numpy/numpy/blob/main/tools/wheels/upload_wheels.sh
3+
4+
set_upload_vars() {
5+
echo "IS_SCHEDULE_DISPATCH is $IS_SCHEDULE_DISPATCH"
6+
if [[ "$IS_SCHEDULE_DISPATCH" == "true" ]]; then
7+
echo scheduled or dispatched event
8+
export ANACONDA_ORG="scientific-python-nightly-wheels"
9+
export TOKEN="$PANDAS_NIGHTLY_UPLOAD_TOKEN"
10+
export ANACONDA_UPLOAD="true"
11+
else
12+
echo non-dispatch event
13+
export ANACONDA_UPLOAD="false"
14+
fi
15+
}
16+
upload_wheels() {
17+
echo "${PWD}"
18+
if [[ ${ANACONDA_UPLOAD} == true ]]; then
19+
if [ -z "${TOKEN}" ]; then
20+
echo no token set, not uploading
21+
else
22+
# sdists are located under dist folder when built through setup.py
23+
if compgen -G "./dist/*.gz"; then
24+
echo "Found sdist"
25+
anaconda -q -t "${TOKEN}" upload --skip -u "${ANACONDA_ORG}" ./dist/*.gz
26+
echo "Uploaded sdist"
27+
fi
28+
if compgen -G "./wheelhouse/*.whl"; then
29+
echo "Found wheel"
30+
anaconda -q -t "${TOKEN}" upload --skip -u "${ANACONDA_ORG}" ./wheelhouse/*.whl
31+
echo "Uploaded wheel"
32+
fi
33+
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
34+
fi
35+
fi
36+
}

doc/source/getting_started/install.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ Package Minimum support
150150
================================================================ ==========================
151151
`NumPy <https://numpy.org>`__ 1.26.0
152152
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.2
153-
`tzdata <https://pypi.org/project/tzdata/>`__ 2023.3
153+
`tzdata <https://pypi.org/project/tzdata/>`__ \* /
154154
================================================================ ==========================
155155

156+
\* ``tzdata`` is only required on Windows and Pyodide (Emscripten).
157+
156158
Generally, the minimum supported version is ~2 years old from the release date of a major or minor pandas version.
157159

158160
.. _install.optional_dependencies:

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,6 @@ The following required dependencies were updated:
686686
+=================+======================+
687687
| numpy | 1.26.0 |
688688
+-----------------+----------------------+
689-
| tzdata | 2023.3 |
690-
+-----------------+----------------------+
691689

692690
For `optional libraries <https://pandas.pydata.org/docs/getting_started/install.html>`_ the general recommendation is to use the latest version.
693691
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
@@ -820,6 +818,7 @@ Other API changes
820818
:meth:`~DataFrame.ffill`, :meth:`~DataFrame.bfill`, :meth:`~DataFrame.interpolate`,
821819
:meth:`~DataFrame.where`, :meth:`~DataFrame.mask`, :meth:`~DataFrame.clip`) now return
822820
the modified DataFrame or Series (``self``) instead of ``None`` when ``inplace=True`` (:issue:`63207`)
821+
- All Index constructors now copy ``numpy.ndarray`` and ``ExtensionArray`` inputs by default when ``copy=None``, consistent with :class:`Series` behavior (:issue:`63388`)
823822

824823
.. ---------------------------------------------------------------------------
825824
.. _whatsnew_300.deprecations:
@@ -1160,6 +1159,7 @@ Timedelta
11601159
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`)
11611160
- Bug in :class:`Timedelta` constructor failing to raise when passed an invalid keyword (:issue:`53801`)
11621161
- Bug in :meth:`DataFrame.cumsum` which was raising ``IndexError`` if dtype is ``timedelta64[ns]`` (:issue:`57956`)
1162+
- Bug in adding or subtracting a :class:`Timedelta` object with non-nanosecond unit to a python ``datetime.datetime`` object giving incorrect results; this now works correctly for Timedeltas inside the ``datetime.timedelta`` implementation bounds (:issue:`53643`)
11631163
- Bug in multiplication operations with ``timedelta64`` dtype failing to raise ``TypeError`` when multiplying by ``bool`` objects or dtypes (:issue:`58054`)
11641164
- Bug in multiplication operations with ``timedelta64`` dtype incorrectly raising when multiplying by numpy-nullable dtypes or pyarrow integer dtypes (:issue:`58054`)
11651165

@@ -1227,6 +1227,7 @@ Indexing
12271227
- 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`)
12281228
- Bug in :meth:`Index.__getitem__` incorrectly raising with a 0-dim ``np.ndarray`` key (:issue:`55601`)
12291229
- Bug in :meth:`Index.get_indexer` not casting missing values correctly for new string datatype (:issue:`55833`)
1230+
- Bug in :meth:`Index.intersection`, :meth:`Index.union`, :meth:`MultiIndex.intersection`, and :meth:`MultiIndex.union` returning a reference to the original Index instead of a new instance when operating on identical indexes, which could cause metadata corruption when modifying the result (:issue:`63169`)
12301231
- 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`)
12311232
- Bug in indexing on a :class:`DatetimeIndex` with a ``timestamp[pyarrow]`` dtype or on a :class:`TimedeltaIndex` with a ``duration[pyarrow]`` dtype (:issue:`62277`)
12321233

pandas/_libs/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ foreach ext_name, ext_dict : libs_sources
160160
ext_dict.get('sources'),
161161
cython_args: cython_args,
162162
include_directories: [inc_np, inc_pd],
163-
dependencies: ext_dict.get('deps', ''),
163+
dependencies: ext_dict.get('deps', []),
164164
subdir: 'pandas/_libs',
165165
install: true,
166166
)

pandas/_libs/tslibs/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ foreach ext_name, ext_dict : tslibs_sources
4040
ext_dict.get('sources'),
4141
cython_args: cython_args,
4242
include_directories: [inc_np, inc_pd],
43-
dependencies: ext_dict.get('deps', ''),
43+
dependencies: ext_dict.get('deps', []),
4444
subdir: 'pandas/_libs/tslibs',
4545
install: true,
4646
)

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,9 +1022,23 @@ cdef _timedelta_from_value_and_reso(cls, int64_t value, NPY_DATETIMEUNIT reso):
10221022
elif reso == NPY_DATETIMEUNIT.NPY_FR_us:
10231023
td_base = _Timedelta.__new__(cls, microseconds=int(value))
10241024
elif reso == NPY_DATETIMEUNIT.NPY_FR_ms:
1025-
td_base = _Timedelta.__new__(cls, milliseconds=0)
1025+
if -86_399_999_913_600_000 <= value < 86_400_000_000_000_000:
1026+
# i.e. we are in range for pytimedelta. By passing the
1027+
# 'correct' value here we can
1028+
# make pydatetime + Timedelta operations work correctly,
1029+
# xref GH#53643
1030+
td_base = _Timedelta.__new__(cls, milliseconds=value)
1031+
else:
1032+
td_base = _Timedelta.__new__(cls, milliseconds=0)
10261033
elif reso == NPY_DATETIMEUNIT.NPY_FR_s:
1027-
td_base = _Timedelta.__new__(cls, seconds=0)
1034+
if -86_399_999_913_600 <= value < 86_400_000_000_000:
1035+
# i.e. we are in range for pytimedelta. By passing the
1036+
# 'correct' value here we can
1037+
# make pydatetime + Timedelta operations work correctly,
1038+
# xref GH#53643
1039+
td_base = _Timedelta.__new__(cls, seconds=value)
1040+
else:
1041+
td_base = _Timedelta.__new__(cls, seconds=0)
10281042
# Other resolutions are disabled but could potentially be implemented here:
10291043
# elif reso == NPY_DATETIMEUNIT.NPY_FR_m:
10301044
# td_base = _Timedelta.__new__(Timedelta, minutes=int(value))

pandas/_libs/tslibs/timezones.pyx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ cdef bint is_utc_zoneinfo(tzinfo tz):
5959
utc_zoneinfo = zoneinfo.ZoneInfo("UTC")
6060
except zoneinfo.ZoneInfoNotFoundError:
6161
return False
62-
# Warn if tzdata is too old, even if there is a system tzdata to alert
63-
# users about the mismatch between local/system tzdata
64-
import_optional_dependency("tzdata", errors="warn", min_version="2022.7")
6562

6663
return tz is utc_zoneinfo
6764

0 commit comments

Comments
 (0)