Skip to content

Commit 297f4e8

Browse files
committed
Merge remote-tracking branch 'upstream/main' into bump/optional
2 parents 7dfe5bc + 513e787 commit 297f4e8

File tree

157 files changed

+2972
-627
lines changed

Some content is hidden

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

157 files changed

+2972
-627
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# ci
55
ci/ @mroeschke
66

7-
# web
8-
web/ @datapythonista
9-
107
# docs
118
doc/cheatsheet @Dr-Irv
129
doc/source/development @noatamir

.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.0
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ 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.9.9
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -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
@@ -106,6 +106,11 @@ repos:
106106
hooks:
107107
- id: meson-fmt
108108
args: ['--inplace']
109+
- repo: https://github.com/shellcheck-py/shellcheck-py
110+
rev: v0.10.0.1
111+
hooks:
112+
- id: shellcheck
113+
args: ["--severity=warning"]
109114
- repo: local
110115
hooks:
111116
- id: pyright

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/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: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ else
2424
fi
2525

2626
[[ -z "$CHECK" || "$CHECK" == "code" || "$CHECK" == "doctests" || "$CHECK" == "docstrings" || "$CHECK" == "single-docs" || "$CHECK" == "notebooks" ]] || \
27-
{ echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|single-docs|notebooks]"; exit 9999; }
27+
{ echo "Unknown command $1. Usage: $0 [code|doctests|docstrings|single-docs|notebooks]"; exit 1; }
2828

29-
BASE_DIR="$(dirname $0)/.."
29+
BASE_DIR="$(dirname "$0")/.."
3030
RET=0
3131

3232
### CODE ###
3333
if [[ -z "$CHECK" || "$CHECK" == "code" ]]; then
3434

35-
MSG='Check import. No warnings, and blocklist some optional dependencies' ; echo $MSG
35+
MSG='Check import. No warnings, and blocklist some optional dependencies' ; echo "$MSG"
3636
python -W error -c "
3737
import sys
3838
import pandas
@@ -49,24 +49,24 @@ if mods:
4949
sys.stderr.write('err: pandas should not import: {}\n'.format(', '.join(mods)))
5050
sys.exit(len(mods))
5151
"
52-
RET=$(($RET + $?)) ; echo $MSG "DONE"
52+
RET=$(($RET + $?)) ; echo "$MSG" "DONE"
5353

5454
fi
5555

5656
### DOCTESTS ###
5757
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
5858

59-
MSG='Python and Cython Doctests' ; echo $MSG
59+
MSG='Python and Cython Doctests' ; echo "$MSG"
6060
python -c 'import pandas as pd; pd.test(run_doctests=True)'
61-
RET=$(($RET + $?)) ; echo $MSG "DONE"
61+
RET=$(($RET + $?)) ; echo "$MSG" "DONE"
6262

6363
fi
6464

6565
### DOCSTRINGS ###
6666
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
6767

68-
MSG='Validate Docstrings' ; echo $MSG
69-
$BASE_DIR/scripts/validate_docstrings.py \
68+
MSG='Validate Docstrings' ; echo "$MSG"
69+
"$BASE_DIR"/scripts/validate_docstrings.py \
7070
--format=actions \
7171
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
@@ -83,6 +83,16 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8383
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
8484
-i "pandas.core.resample.Resampler.quantile PR01,PR07" \
8585
-i "pandas.tseries.offsets.BDay PR02,SA01" \
86+
-i "pandas.tseries.offsets.BHalfYearBegin.is_on_offset GL08" \
87+
-i "pandas.tseries.offsets.BHalfYearBegin.n GL08" \
88+
-i "pandas.tseries.offsets.BHalfYearBegin.normalize GL08" \
89+
-i "pandas.tseries.offsets.BHalfYearBegin.rule_code GL08" \
90+
-i "pandas.tseries.offsets.BHalfYearBegin.startingMonth GL08" \
91+
-i "pandas.tseries.offsets.BHalfYearEnd.is_on_offset GL08" \
92+
-i "pandas.tseries.offsets.BHalfYearEnd.n GL08" \
93+
-i "pandas.tseries.offsets.BHalfYearEnd.normalize GL08" \
94+
-i "pandas.tseries.offsets.BHalfYearEnd.rule_code GL08" \
95+
-i "pandas.tseries.offsets.BHalfYearEnd.startingMonth GL08" \
8696
-i "pandas.tseries.offsets.BQuarterBegin.is_on_offset GL08" \
8797
-i "pandas.tseries.offsets.BQuarterBegin.n GL08" \
8898
-i "pandas.tseries.offsets.BQuarterBegin.normalize GL08" \
@@ -185,6 +195,16 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
185195
-i "pandas.tseries.offsets.FY5253Quarter.variation GL08" \
186196
-i "pandas.tseries.offsets.FY5253Quarter.weekday GL08" \
187197
-i "pandas.tseries.offsets.FY5253Quarter.year_has_extra_week GL08" \
198+
-i "pandas.tseries.offsets.HalfYearBegin.is_on_offset GL08" \
199+
-i "pandas.tseries.offsets.HalfYearBegin.n GL08" \
200+
-i "pandas.tseries.offsets.HalfYearBegin.normalize GL08" \
201+
-i "pandas.tseries.offsets.HalfYearBegin.rule_code GL08" \
202+
-i "pandas.tseries.offsets.HalfYearBegin.startingMonth GL08" \
203+
-i "pandas.tseries.offsets.HalfYearEnd.is_on_offset GL08" \
204+
-i "pandas.tseries.offsets.HalfYearEnd.n GL08" \
205+
-i "pandas.tseries.offsets.HalfYearEnd.normalize GL08" \
206+
-i "pandas.tseries.offsets.HalfYearEnd.rule_code GL08" \
207+
-i "pandas.tseries.offsets.HalfYearEnd.startingMonth GL08" \
188208
-i "pandas.tseries.offsets.Hour.is_on_offset GL08" \
189209
-i "pandas.tseries.offsets.Hour.n GL08" \
190210
-i "pandas.tseries.offsets.Hour.normalize GL08" \
@@ -265,7 +285,7 @@ fi
265285
if [[ -z "$CHECK" || "$CHECK" == "notebooks" ]]; then
266286

267287
MSG='Notebooks' ; echo $MSG
268-
jupyter nbconvert --execute $(find doc/source -name '*.ipynb') --to notebook
288+
jupyter nbconvert --execute "$(find doc/source -name '*.ipynb')" --to notebook
269289
RET=$(($RET + $?)) ; echo $MSG "DONE"
270290

271291
fi

ci/run_tests.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
# Workaround for pytest-xdist (it collects different tests in the workers if PYTHONHASHSEED is not set)
44
# https://github.com/pytest-dev/pytest/issues/920
55
# https://github.com/pytest-dev/pytest/issues/1075
6-
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
7-
8-
# May help reproduce flaky CI builds if set in subsequent runs
9-
echo PYTHONHASHSEED=$PYTHONHASHSEED
6+
PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
7+
export PYTHONHASHSEED
108

119
COVERAGE="-s --cov=pandas --cov-report=xml --cov-append --cov-config=pyproject.toml"
1210

@@ -16,5 +14,5 @@ if [[ "$PATTERN" ]]; then
1614
PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\""
1715
fi
1816

19-
echo $PYTEST_CMD
17+
echo "$PYTEST_CMD"
2018
sh -c "$PYTEST_CMD"

ci/upload_wheels.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12
# Modified from numpy's https://github.com/numpy/numpy/blob/main/tools/wheels/upload_wheels.sh
23

34
set_upload_vars() {
@@ -19,20 +20,20 @@ set_upload_vars() {
1920
fi
2021
}
2122
upload_wheels() {
22-
echo ${PWD}
23+
echo "${PWD}"
2324
if [[ ${ANACONDA_UPLOAD} == true ]]; then
24-
if [ -z ${TOKEN} ]; then
25+
if [ -z "${TOKEN}" ]; then
2526
echo no token set, not uploading
2627
else
2728
# sdists are located under dist folder when built through setup.py
2829
if compgen -G "./dist/*.gz"; then
2930
echo "Found sdist"
30-
anaconda -q -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./dist/*.gz
31+
anaconda -q -t "${TOKEN}" upload --skip -u "${ANACONDA_ORG}" ./dist/*.gz
3132
echo "Uploaded sdist"
3233
fi
3334
if compgen -G "./wheelhouse/*.whl"; then
3435
echo "Found wheel"
35-
anaconda -q -t ${TOKEN} upload --skip -u ${ANACONDA_ORG} ./wheelhouse/*.whl
36+
anaconda -q -t "${TOKEN}" upload --skip -u "${ANACONDA_ORG}" ./wheelhouse/*.whl
3637
echo "Uploaded wheel"
3738
fi
3839
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"

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
@@ -344,7 +344,7 @@ be located.
344344
- tests.scalar
345345
- tests.tseries.offsets
346346

347-
2. Does your test depend only on code in pd._libs?
347+
2. Does your test depend only on code in ``pd._libs``?
348348
This test likely belongs in one of:
349349

350350
- tests.libs

doc/source/development/contributing_gitpod.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ development experience:
109109

110110
* `VSCode rst extension <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext>`_
111111
* `Markdown All in One <https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one>`_
112-
* `VSCode Gitlens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_
112+
* `VSCode GitLens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_
113113
* `VSCode Git Graph extension <https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph>`_
114114

115115
Development workflow with Gitpod

doc/source/development/developer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Column metadata
9999
* Boolean: ``'bool'``
100100
* Integers: ``'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64'``
101101
* Floats: ``'float16', 'float32', 'float64'``
102-
* Date and Time Types: ``'datetime', 'datetimetz'``, ``'timedelta'``
102+
* Date and Time Types: ``'datetime', 'datetimetz', 'timedelta'``
103103
* String: ``'unicode', 'bytes'``
104104
* Categorical: ``'categorical'``
105105
* Other Python objects: ``'object'``

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/arrays.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ is an :class:`ArrowDtype`.
6161
support as NumPy including first-class nullability support for all data types, immutability and more.
6262

6363
The table below shows the equivalent pyarrow-backed (``pa``), pandas extension, and numpy (``np``) types that are recognized by pandas.
64-
Pyarrow-backed types below need to be passed into :class:`ArrowDtype` to be recognized by pandas e.g. ``pd.ArrowDtype(pa.bool_())``
64+
Pyarrow-backed types below need to be passed into :class:`ArrowDtype` to be recognized by pandas e.g. ``pd.ArrowDtype(pa.bool_())``.
6565

6666
=============================================== ========================== ===================
6767
PyArrow type pandas extension type NumPy type
@@ -114,7 +114,7 @@ values.
114114

115115
ArrowDtype
116116

117-
For more information, please see the :ref:`PyArrow user guide <pyarrow>`
117+
For more information, please see the :ref:`PyArrow user guide <pyarrow>`.
118118

119119
.. _api.arrays.datetime:
120120

@@ -495,7 +495,7 @@ a :class:`CategoricalDtype`.
495495
CategoricalDtype.categories
496496
CategoricalDtype.ordered
497497

498-
Categorical data can be stored in a :class:`pandas.Categorical`
498+
Categorical data can be stored in a :class:`pandas.Categorical`:
499499

500500
.. autosummary::
501501
:toctree: api/

0 commit comments

Comments
 (0)