Skip to content

Commit b2c1272

Browse files
Merge branch 'main' into issue57049
2 parents 67c758b + 5fef979 commit b2c1272

File tree

204 files changed

+4083
-1362
lines changed

Some content is hidden

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

204 files changed

+4083
-1362
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ doc/source/development @noatamir
1010

1111
# pandas
1212
pandas/_libs/ @WillAyd
13-
pandas/_libs/tslibs/* @MarcoGorelli
1413
pandas/_typing.py @Dr-Irv
1514
pandas/core/groupby/* @rhshadrach
16-
pandas/core/tools/datetimes.py @MarcoGorelli
1715
pandas/io/excel/* @rhshadrach
1816
pandas/io/formats/style.py @attack68
1917
pandas/io/formats/style_render.py @attack68

.github/actions/run-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
if: failure()
1515

1616
- name: Upload coverage to Codecov
17-
uses: codecov/codecov-action@v4
17+
uses: codecov/codecov-action@v5
1818
with:
1919
flags: unittests
2020
name: codecov-pandas

.github/actions/setup-conda/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ runs:
77
using: composite
88
steps:
99
- name: Install ${{ inputs.environment-file }}
10-
uses: mamba-org/setup-micromamba@v1
10+
uses: mamba-org/setup-micromamba@v2
1111
with:
1212
environment-file: ${{ inputs.environment-file }}
1313
environment-name: test

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ jobs:
5959
- name: Build documentation
6060
run: doc/make.py --warnings-are-errors
6161

62+
- name: Build the interactive terminal
63+
working-directory: web/interactive_terminal
64+
run: jupyter lite build
65+
6266
- name: Build documentation zip
6367
run: doc/make.py zip_html
6468

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
154154

155155
- name: Build wheels
156-
uses: pypa/cibuildwheel@v2.22.0
156+
uses: pypa/cibuildwheel@v2.23.2
157157
with:
158158
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
159159
env:

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
minimum_pre_commit_version: 2.15.0
1+
minimum_pre_commit_version: 4.0.0
22
exclude: ^LICENSES/|\.(html|csv|svg)$
33
# reserve "manual" for relatively slow hooks which we still want to run in CI
44
default_stages: [
@@ -19,13 +19,13 @@ ci:
1919
skip: [pyright, mypy]
2020
repos:
2121
- repo: https://github.com/astral-sh/ruff-pre-commit
22-
rev: v0.9.4
22+
rev: v0.11.4
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
2626
exclude: ^pandas/tests/frame/test_query_eval.py
2727
- id: ruff
28-
# TODO: remove autofixe-only rules when they are checked by ruff
28+
# TODO: remove autofix only rules when they are checked by ruff
2929
name: ruff-selected-autofixes
3030
alias: ruff-selected-autofixes
3131
files: ^pandas
@@ -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.14'
37+
rev: v2.14
3838
hooks:
3939
- id: vulture
4040
entry: python scripts/run_vulture.py
@@ -70,7 +70,7 @@ repos:
7070
- id: trailing-whitespace
7171
args: [--markdown-linebreak-ext=md]
7272
- repo: https://github.com/PyCQA/isort
73-
rev: 6.0.0
73+
rev: 6.0.1
7474
hooks:
7575
- id: isort
7676
- repo: https://github.com/asottile/pyupgrade
@@ -95,14 +95,14 @@ 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.7
98+
rev: v20.1.0
9999
hooks:
100100
- id: clang-format
101101
files: ^pandas/_libs/src|^pandas/_libs/include
102102
args: [-i]
103103
types_or: [c, c++]
104104
- repo: https://github.com/trim21/pre-commit-mirror-meson
105-
rev: v1.7.0
105+
rev: v1.7.2
106106
hooks:
107107
- id: meson-fmt
108108
args: ['--inplace']

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ COPY requirements-dev.txt /tmp
1313
RUN python -m pip install -r /tmp/requirements-dev.txt
1414
RUN git config --global --add safe.directory /home/pandas
1515

16-
ENV SHELL "/bin/bash"
16+
ENV SHELL="/bin/bash"
1717
CMD ["/bin/bash"]

asv_bench/benchmarks/frame_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def setup(self):
517517
self.df = DataFrame(np.random.randn(1000, 100))
518518

519519
self.s = Series(np.arange(1028.0))
520-
self.df2 = DataFrame({i: self.s for i in range(1028)})
520+
self.df2 = DataFrame(dict.fromkeys(range(1028), self.s))
521521
self.df3 = DataFrame(np.random.randn(1000, 3), columns=list("ABC"))
522522

523523
def time_apply_user_func(self):

asv_bench/benchmarks/indexing_engines.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ class NumericEngineIndexing:
6767
def setup(self, engine_and_dtype, index_type, unique, N):
6868
engine, dtype = engine_and_dtype
6969

70+
if (
71+
index_type == "non_monotonic"
72+
and dtype in [np.int16, np.int8, np.uint8]
73+
and unique
74+
):
75+
# Values overflow
76+
raise NotImplementedError
77+
7078
if index_type == "monotonic_incr":
7179
if unique:
7280
arr = np.arange(N * 3, dtype=dtype)
@@ -115,6 +123,14 @@ def setup(self, engine_and_dtype, index_type, unique, N):
115123
engine, dtype = engine_and_dtype
116124
dtype = dtype.lower()
117125

126+
if (
127+
index_type == "non_monotonic"
128+
and dtype in ["int16", "int8", "uint8"]
129+
and unique
130+
):
131+
# Values overflow
132+
raise NotImplementedError
133+
118134
if index_type == "monotonic_incr":
119135
if unique:
120136
arr = np.arange(N * 3, dtype=dtype)

asv_bench/benchmarks/rolling.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ class Methods:
1010
["DataFrame", "Series"],
1111
[("rolling", {"window": 10}), ("rolling", {"window": 1000}), ("expanding", {})],
1212
["int", "float"],
13-
["median", "mean", "max", "min", "std", "count", "skew", "kurt", "sum", "sem"],
13+
[
14+
"median",
15+
"mean",
16+
"max",
17+
"min",
18+
"std",
19+
"count",
20+
"skew",
21+
"kurt",
22+
"sum",
23+
"sem",
24+
"nunique",
25+
],
1426
)
1527
param_names = ["constructor", "window_kwargs", "dtype", "method"]
1628

ci/code_checks.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,20 @@ 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.Timedelta.max PR02" \
76-
-i "pandas.Timedelta.min PR02" \
77-
-i "pandas.Timedelta.resolution PR02" \
78-
-i "pandas.Timestamp.max PR02" \
79-
-i "pandas.Timestamp.min PR02" \
80-
-i "pandas.Timestamp.resolution PR02" \
81-
-i "pandas.Timestamp.tzinfo GL08" \
8275
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
8376
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
8477
-i "pandas.core.resample.Resampler.quantile PR01,PR07" \
8578
-i "pandas.tseries.offsets.BDay PR02,SA01" \
79+
-i "pandas.tseries.offsets.BHalfYearBegin.is_on_offset GL08" \
80+
-i "pandas.tseries.offsets.BHalfYearBegin.n GL08" \
81+
-i "pandas.tseries.offsets.BHalfYearBegin.normalize GL08" \
82+
-i "pandas.tseries.offsets.BHalfYearBegin.rule_code GL08" \
83+
-i "pandas.tseries.offsets.BHalfYearBegin.startingMonth GL08" \
84+
-i "pandas.tseries.offsets.BHalfYearEnd.is_on_offset GL08" \
85+
-i "pandas.tseries.offsets.BHalfYearEnd.n GL08" \
86+
-i "pandas.tseries.offsets.BHalfYearEnd.normalize GL08" \
87+
-i "pandas.tseries.offsets.BHalfYearEnd.rule_code GL08" \
88+
-i "pandas.tseries.offsets.BHalfYearEnd.startingMonth GL08" \
8689
-i "pandas.tseries.offsets.BQuarterBegin.is_on_offset GL08" \
8790
-i "pandas.tseries.offsets.BQuarterBegin.n GL08" \
8891
-i "pandas.tseries.offsets.BQuarterBegin.normalize GL08" \
@@ -185,6 +188,16 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
185188
-i "pandas.tseries.offsets.FY5253Quarter.variation GL08" \
186189
-i "pandas.tseries.offsets.FY5253Quarter.weekday GL08" \
187190
-i "pandas.tseries.offsets.FY5253Quarter.year_has_extra_week GL08" \
191+
-i "pandas.tseries.offsets.HalfYearBegin.is_on_offset GL08" \
192+
-i "pandas.tseries.offsets.HalfYearBegin.n GL08" \
193+
-i "pandas.tseries.offsets.HalfYearBegin.normalize GL08" \
194+
-i "pandas.tseries.offsets.HalfYearBegin.rule_code GL08" \
195+
-i "pandas.tseries.offsets.HalfYearBegin.startingMonth GL08" \
196+
-i "pandas.tseries.offsets.HalfYearEnd.is_on_offset GL08" \
197+
-i "pandas.tseries.offsets.HalfYearEnd.n GL08" \
198+
-i "pandas.tseries.offsets.HalfYearEnd.normalize GL08" \
199+
-i "pandas.tseries.offsets.HalfYearEnd.rule_code GL08" \
200+
-i "pandas.tseries.offsets.HalfYearEnd.startingMonth GL08" \
188201
-i "pandas.tseries.offsets.Hour.is_on_offset GL08" \
189202
-i "pandas.tseries.offsets.Hour.n GL08" \
190203
-i "pandas.tseries.offsets.Hour.normalize GL08" \

ci/meta.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,3 @@ extra:
8989
- datapythonista
9090
- phofl
9191
- lithomas1
92-
- marcogorelli

doc/source/development/contributing_codebase.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ In some cases you may be tempted to use ``cast`` from the typing module when you
198198
obj = cast(str, obj) # Mypy complains without this!
199199
return obj.upper()
200200
201-
The limitation here is that while a human can reasonably understand that ``is_number`` would catch the ``int`` and ``float`` types mypy cannot make that same inference just yet (see `mypy #5206 <https://github.com/python/mypy/issues/5206>`_. While the above works, the use of ``cast`` is **strongly discouraged**. Where applicable a refactor of the code to appease static analysis is preferable
201+
The limitation here is that while a human can reasonably understand that ``is_number`` would catch the ``int`` and ``float`` types mypy cannot make that same inference just yet (see `mypy #5206 <https://github.com/python/mypy/issues/5206>`_). While the above works, the use of ``cast`` is **strongly discouraged**. Where applicable a refactor of the code to appease static analysis is preferable
202202

203203
.. code-block:: python
204204
@@ -537,7 +537,7 @@ Preferred ``pytest`` idioms
537537
test and does not check if the test will fail. If this is the behavior you desire, use ``pytest.skip`` instead.
538538

539539
If a test is known to fail but the manner in which it fails
540-
is not meant to be captured, use ``pytest.mark.xfail`` It is common to use this method for a test that
540+
is not meant to be captured, use ``pytest.mark.xfail``. It is common to use this method for a test that
541541
exhibits buggy behavior or a non-implemented feature. If
542542
the failing test has flaky behavior, use the argument ``strict=False``. This
543543
will make it so pytest does not fail if the test happens to pass. Using ``strict=False`` is highly undesirable, please use it only as a last resort.

doc/source/development/debugging_extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ By default building pandas from source will generate a release build. To generat
2323

2424
.. note::
2525

26-
conda environments update CFLAGS/CPPFLAGS with flags that are geared towards generating releases. If using conda, you may need to set ``CFLAGS="$CFLAGS -O0"`` and ``CPPFLAGS="$CPPFLAGS -O0"`` to ensure optimizations are turned off for debugging
26+
conda environments update CFLAGS/CPPFLAGS with flags that are geared towards generating releases, and may work counter towards usage in a development environment. If using conda, you should unset these environment variables via ``export CFLAGS=`` and ``export CPPFLAGS=``
2727

2828
By specifying ``builddir="debug"`` all of the targets will be built and placed in the debug directory relative to the project root. This helps to keep your debug and release artifacts separate; you are of course able to choose a different directory name or omit altogether if you do not care to separate build types.
2929

doc/source/getting_started/comparison/comparison_with_r.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ In Python, since ``a`` is a list, you can simply use list comprehension.
383383

384384
.. ipython:: python
385385
386-
a = np.array(list(range(1, 24)) + [np.NAN]).reshape(2, 3, 4)
386+
a = np.array(list(range(1, 24)) + [np.nan]).reshape(2, 3, 4)
387387
pd.DataFrame([tuple(list(x) + [val]) for x, val in np.ndenumerate(a)])
388388
389389
meltlist
@@ -402,7 +402,7 @@ In Python, this list would be a list of tuples, so
402402

403403
.. ipython:: python
404404
405-
a = list(enumerate(list(range(1, 5)) + [np.NAN]))
405+
a = list(enumerate(list(range(1, 5)) + [np.nan]))
406406
pd.DataFrame(a)
407407
408408
For more details and examples see :ref:`the Intro to Data Structures

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ the name ``anonymous`` to the first 3 elements of the fourth column:
335335
.. ipython:: python
336336
337337
titanic.iloc[0:3, 3] = "anonymous"
338-
titanic.head()
338+
titanic.iloc[:5, 3]
339339
340340
.. raw:: html
341341

doc/source/getting_started/overview.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,4 @@ License
174174
-------
175175

176176
.. literalinclude:: ../../../LICENSE
177+
:language: none

doc/source/reference/groupby.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Function application
7979
DataFrameGroupBy.cumsum
8080
DataFrameGroupBy.describe
8181
DataFrameGroupBy.diff
82+
DataFrameGroupBy.ewm
83+
DataFrameGroupBy.expanding
8284
DataFrameGroupBy.ffill
8385
DataFrameGroupBy.first
8486
DataFrameGroupBy.head
@@ -130,6 +132,8 @@ Function application
130132
SeriesGroupBy.cumsum
131133
SeriesGroupBy.describe
132134
SeriesGroupBy.diff
135+
SeriesGroupBy.ewm
136+
SeriesGroupBy.expanding
133137
SeriesGroupBy.ffill
134138
SeriesGroupBy.first
135139
SeriesGroupBy.head

0 commit comments

Comments
 (0)