Skip to content

Commit c084364

Browse files
Merge remote-tracking branch 'upstream/main' into add_typehints_index
2 parents 561120b + 794913c commit c084364

File tree

170 files changed

+2631
-2535
lines changed

Some content is hidden

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

170 files changed

+2631
-2535
lines changed

.github/workflows/unit-tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,52 @@ jobs:
346346
- name: Run Tests
347347
uses: ./.github/actions/run-tests
348348

349+
python-freethreading:
350+
defaults:
351+
run:
352+
shell: bash -eou pipefail {0}
353+
runs-on: ubuntu-22.04
354+
355+
timeout-minutes: 90
356+
357+
concurrency:
358+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
359+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-python-freethreading-dev
360+
cancel-in-progress: true
361+
362+
env:
363+
PYTEST_WORKERS: "auto"
364+
PANDAS_CI: 1
365+
PATTERN: "not slow and not network and not clipboard and not single_cpu"
366+
PYTEST_TARGET: pandas
367+
368+
steps:
369+
- uses: actions/checkout@v4
370+
with:
371+
fetch-depth: 0
372+
373+
- name: Set up Python Free-threading Version
374+
uses: deadsnakes/[email protected]
375+
with:
376+
python-version: 3.13-dev
377+
nogil: true
378+
379+
- name: Build Environment
380+
run: |
381+
python --version
382+
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
383+
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
384+
python -m pip install versioneer[toml]
385+
python -m pip install python-dateutil pytz tzdata hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
386+
python -m pip install -ve . --no-build-isolation --no-index --no-deps --config-settings=setup-args="--werror"
387+
python -m pip list
388+
389+
- name: Run Tests
390+
uses: ./.github/actions/run-tests
391+
env:
392+
PYTHON_GIL: 0
393+
394+
# NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml
349395
emscripten:
350396
# Note: the Python version, Emscripten toolchain version are determined
351397
# by the Pyodide version. The appropriate versions can be found in the

.github/workflows/wheels.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ jobs:
100100
- [windows-2022, win_amd64]
101101
# TODO: support PyPy?
102102
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"]]
103+
104+
# Build Pyodide wheels and upload them to Anaconda.org
105+
# NOTE: this job is similar to the one in unit-tests.yml except for the fact
106+
# 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"]
103110
env:
104111
IS_PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
105112
IS_SCHEDULE_DISPATCH: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -140,12 +147,13 @@ jobs:
140147
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
141148

142149
- name: Build wheels
143-
uses: pypa/[email protected].1
150+
uses: pypa/[email protected].2
144151
with:
145152
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
146153
env:
147154
CIBW_PRERELEASE_PYTHONS: True
148155
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
156+
CIBW_PLATFORM: ${{ matrix.buildplat[1] == 'pyodide_wasm32' && 'pyodide' || 'auto' }}
149157

150158
- name: Set up Python
151159
uses: mamba-org/setup-micromamba@v1

.pre-commit-config.yaml

Lines changed: 4 additions & 3 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.4.7
22+
rev: v0.5.0
2323
hooks:
2424
- id: ruff
2525
args: [--exit-non-zero-on-fix]
@@ -67,12 +67,13 @@ repos:
6767
- id: fix-encoding-pragma
6868
args: [--remove]
6969
- id: trailing-whitespace
70+
args: [--markdown-linebreak-ext=md]
7071
- repo: https://github.com/PyCQA/isort
7172
rev: 5.13.2
7273
hooks:
7374
- id: isort
7475
- repo: https://github.com/asottile/pyupgrade
75-
rev: v3.15.2
76+
rev: v3.16.0
7677
hooks:
7778
- id: pyupgrade
7879
args: [--py310-plus]
@@ -92,7 +93,7 @@ repos:
9293
- id: sphinx-lint
9394
args: ["--enable", "all", "--disable", "line-too-long"]
9495
- repo: https://github.com/pre-commit/mirrors-clang-format
95-
rev: v18.1.5
96+
rev: v18.1.8
9697
hooks:
9798
- id: clang-format
9899
files: ^pandas/_libs/src|^pandas/_libs/include

asv_bench/benchmarks/indexing.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,24 +546,17 @@ def time_chained_indexing(self, mode):
546546

547547

548548
class Block:
549-
params = [
550-
(True, "True"),
551-
(np.array(True), "np.array(True)"),
552-
]
553-
554-
def setup(self, true_value, mode):
549+
def setup(self):
555550
self.df = DataFrame(
556551
False,
557552
columns=np.arange(500).astype(str),
558553
index=date_range("2010-01-01", "2011-01-01"),
559554
)
560555

561-
self.true_value = true_value
562-
563-
def time_test(self, true_value, mode):
556+
def time_test(self):
564557
start = datetime(2010, 5, 1)
565558
end = datetime(2010, 9, 1)
566-
self.df.loc[start:end, :] = true_value
559+
self.df.loc[start:end, :] = True
567560

568561

569562
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/tslibs/timedelta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def time_from_int(self):
2020
Timedelta(123456789)
2121

2222
def time_from_unit(self):
23-
Timedelta(1, unit="d")
23+
Timedelta(1, unit="D")
2424

2525
def time_from_components(self):
2626
Timedelta(

ci/code_checks.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
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` \
73-
-i "pandas.DataFrame.max RT03" \
74-
-i "pandas.DataFrame.mean RT03" \
75-
-i "pandas.DataFrame.median RT03" \
76-
-i "pandas.DataFrame.min RT03" \
7773
-i "pandas.DataFrame.plot PR02" \
7874
-i "pandas.Grouper PR02" \
7975
-i "pandas.MultiIndex.append PR07,SA01" \
@@ -95,7 +91,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9591
-i "pandas.Period.freq GL08" \
9692
-i "pandas.Period.freqstr SA01" \
9793
-i "pandas.Period.month SA01" \
98-
-i "pandas.Period.now SA01" \
9994
-i "pandas.Period.ordinal GL08" \
10095
-i "pandas.Period.strftime PR01,SA01" \
10196
-i "pandas.Period.to_timestamp SA01" \
@@ -162,12 +157,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
162157
-i "pandas.Series.ne SA01" \
163158
-i "pandas.Series.pad PR01,SA01" \
164159
-i "pandas.Series.plot PR02" \
165-
-i "pandas.Series.pop RT03,SA01" \
160+
-i "pandas.Series.pop SA01" \
166161
-i "pandas.Series.prod RT03" \
167162
-i "pandas.Series.product RT03" \
168163
-i "pandas.Series.reorder_levels RT03,SA01" \
169164
-i "pandas.Series.sem PR01,RT03,SA01" \
170-
-i "pandas.Series.skew RT03,SA01" \
165+
-i "pandas.Series.skew SA01" \
171166
-i "pandas.Series.sparse PR01,SA01" \
172167
-i "pandas.Series.sparse.density SA01" \
173168
-i "pandas.Series.sparse.fill_value SA01" \
@@ -244,13 +239,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
244239
-i "pandas.Timestamp.month_name SA01" \
245240
-i "pandas.Timestamp.nanosecond GL08" \
246241
-i "pandas.Timestamp.normalize SA01" \
247-
-i "pandas.Timestamp.now SA01" \
248242
-i "pandas.Timestamp.quarter SA01" \
249243
-i "pandas.Timestamp.replace PR07,SA01" \
250244
-i "pandas.Timestamp.resolution PR02" \
251245
-i "pandas.Timestamp.second GL08" \
252246
-i "pandas.Timestamp.strptime PR01,SA01" \
253-
-i "pandas.Timestamp.time SA01" \
254247
-i "pandas.Timestamp.timestamp SA01" \
255248
-i "pandas.Timestamp.timetuple SA01" \
256249
-i "pandas.Timestamp.timetz SA01" \
@@ -260,7 +253,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
260253
-i "pandas.Timestamp.to_period PR01,SA01" \
261254
-i "pandas.Timestamp.today SA01" \
262255
-i "pandas.Timestamp.toordinal SA01" \
263-
-i "pandas.Timestamp.tz SA01" \
264256
-i "pandas.Timestamp.tz_localize SA01" \
265257
-i "pandas.Timestamp.tzinfo GL08" \
266258
-i "pandas.Timestamp.tzname SA01" \
@@ -318,11 +310,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
318310
-i "pandas.api.types.is_period_dtype SA01" \
319311
-i "pandas.api.types.is_re PR07,SA01" \
320312
-i "pandas.api.types.is_re_compilable PR07,SA01" \
321-
-i "pandas.api.types.is_signed_integer_dtype SA01" \
322313
-i "pandas.api.types.is_sparse SA01" \
323314
-i "pandas.api.types.is_string_dtype SA01" \
324315
-i "pandas.api.types.is_timedelta64_ns_dtype SA01" \
325-
-i "pandas.api.types.is_unsigned_integer_dtype SA01" \
326316
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
327317
-i "pandas.api.types.union_categoricals RT03,SA01" \
328318
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \

doc/source/getting_started/intro_tutorials/04_plotting.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ How do I create plots in pandas?
3232
air_quality.head()
3333
3434
.. note::
35-
The usage of the ``index_col`` and ``parse_dates`` parameters of the ``read_csv`` function to define the first (0th) column as
36-
index of the resulting ``DataFrame`` and convert the dates in the column to :class:`Timestamp` objects, respectively.
35+
The ``index_col=0`` and ``parse_dates=True`` parameters passed to the ``read_csv`` function define
36+
the first (0th) column as index of the resulting ``DataFrame`` and convert the dates in the column
37+
to :class:`Timestamp` objects, respectively.
38+
3739

3840
.. raw:: html
3941

doc/source/getting_started/overview.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
Package overview
77
****************
88

9-
pandas is a `Python <https://www.python.org>`__ package providing fast,
9+
pandas is a `Python <https://www.python.org>`__ package that provides fast,
1010
flexible, and expressive data structures designed to make working with
1111
"relational" or "labeled" data both easy and intuitive. It aims to be the
12-
fundamental high-level building block for doing practical, **real-world** data
13-
analysis in Python. Additionally, it has the broader goal of becoming **the
12+
fundamental high-level building block for Python's practical, **real-world** data
13+
analysis. Additionally, it seeks to become **the
1414
most powerful and flexible open source data analysis/manipulation tool
1515
available in any language**. It is already well on its way toward this goal.
1616

doc/source/user_guide/categorical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ Assigning a ``Categorical`` to parts of a column of other types will use the val
793793
:okwarning:
794794
795795
df = pd.DataFrame({"a": [1, 1, 1, 1, 1], "b": ["a", "a", "a", "a", "a"]})
796-
df.loc[1:2, "a"] = pd.Categorical(["b", "b"], categories=["a", "b"])
796+
df.loc[1:2, "a"] = pd.Categorical([2, 2], categories=[2, 3])
797797
df.loc[2:3, "b"] = pd.Categorical(["b", "b"], categories=["a", "b"])
798798
df
799799
df.dtypes

doc/source/user_guide/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,7 +2161,7 @@ a JSON string with two fields, ``schema`` and ``data``.
21612161
{
21622162
"A": [1, 2, 3],
21632163
"B": ["a", "b", "c"],
2164-
"C": pd.date_range("2016-01-01", freq="d", periods=3),
2164+
"C": pd.date_range("2016-01-01", freq="D", periods=3),
21652165
},
21662166
index=pd.Index(range(3), name="idx"),
21672167
)
@@ -2270,7 +2270,7 @@ round-trippable manner.
22702270
{
22712271
"foo": [1, 2, 3, 4],
22722272
"bar": ["a", "b", "c", "d"],
2273-
"baz": pd.date_range("2018-01-01", freq="d", periods=4),
2273+
"baz": pd.date_range("2018-01-01", freq="D", periods=4),
22742274
"qux": pd.Categorical(["a", "b", "c", "c"]),
22752275
},
22762276
index=pd.Index(range(4), name="idx"),

0 commit comments

Comments
 (0)