Skip to content

Commit a33515e

Browse files
Merge remote-tracking branch 'upstream/main' into anno2
2 parents 957efd0 + 2f26644 commit a33515e

File tree

18 files changed

+126
-44
lines changed

18 files changed

+126
-44
lines changed

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ jobs:
313313
# To freeze this file, uncomment out the ``if: false`` condition, and migrate the jobs
314314
# to the corresponding posix/windows-macos/sdist etc. workflows.
315315
# Feel free to modify this comment as necessary.
316-
if: false
316+
# if: false
317317
defaults:
318318
run:
319319
shell: bash -eou pipefail {0}
@@ -345,7 +345,7 @@ jobs:
345345
- name: Set up Python Dev Version
346346
uses: actions/setup-python@v6
347347
with:
348-
python-version: '3.13-dev'
348+
python-version: '3.14-dev'
349349

350350
- name: Build Environment
351351
run: |
@@ -358,6 +358,8 @@ jobs:
358358
359359
- name: Run Tests
360360
uses: ./.github/actions/run-tests
361+
# TEMP allow this to fail until we fixed all test failures (related to chained assignment warnings)
362+
continue-on-error: true
361363

362364
# NOTE: this job must be kept in sync with the Pyodide build job in wheels.yml
363365
emscripten:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
| --- | --- |
1212
| Testing | [![CI - Test](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml) [![Coverage](https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=main)](https://codecov.io/gh/pandas-dev/pandas) |
1313
| Package | [![PyPI Latest Release](https://img.shields.io/pypi/v/pandas.svg)](https://pypi.org/project/pandas/) [![PyPI Downloads](https://img.shields.io/pypi/dm/pandas.svg?label=PyPI%20downloads)](https://pypi.org/project/pandas/) [![Conda Latest Release](https://anaconda.org/conda-forge/pandas/badges/version.svg)](https://anaconda.org/conda-forge/pandas) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/pandas) |
14-
| Meta | [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3509134.svg)](https://doi.org/10.5281/zenodo.3509134) [![License - BSD 3-Clause](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/main/LICENSE) [![Slack](https://img.shields.io/badge/join_Slack-information-brightgreen.svg?logo=slack)](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) |
14+
| Meta | [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3509134.svg)](https://doi.org/10.5281/zenodo.3509134) [![License - BSD 3-Clause](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/main/LICENSE) [![Slack](https://img.shields.io/badge/join_Slack-information-brightgreen.svg?logo=slack)](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) [![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=pandas-dev-pandas)](https://insights.linuxfoundation.org/project/pandas-dev-pandas) |
1515

1616

1717
## What is it?

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@ Other Deprecations
649649
- Deprecated ``pd.core.internals.api.maybe_infer_ndim`` (:issue:`40226`)
650650
- Deprecated allowing constructing or casting to :class:`Categorical` with non-NA values that are not present in specified ``dtype.categories`` (:issue:`40996`)
651651
- 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`)
652+
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.groupby` and :meth:`Series.groupby` except ``by`` and ``level``. (:issue:`62102`)
652653
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except ``buf``. (:issue:`57280`)
653654
- Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except ``buf``. (:issue:`57280`)
654655
- 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`)

pandas/_libs/sparse.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
from collections.abc import Sequence
21
from typing import Self
32

43
import numpy as np
54

6-
from pandas._typing import npt
5+
from pandas._typing import (
6+
TakeIndexer,
7+
npt,
8+
)
79

810
class SparseIndex:
911
length: int
@@ -26,7 +28,7 @@ class SparseIndex:
2628
class IntIndex(SparseIndex):
2729
indices: npt.NDArray[np.int32]
2830
def __init__(
29-
self, length: int, indices: Sequence[int], check_integrity: bool = ...
31+
self, length: int, indices: TakeIndexer, check_integrity: bool = ...
3032
) -> None: ...
3133

3234
class BlockIndex(SparseIndex):

pandas/compat/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
IS64,
2020
ISMUSL,
2121
PY312,
22+
PY314,
2223
PYPY,
2324
WASM,
2425
)
@@ -154,6 +155,7 @@ def is_ci_environment() -> bool:
154155
"IS64",
155156
"ISMUSL",
156157
"PY312",
158+
"PY314",
157159
"PYARROW_MIN_VERSION",
158160
"PYPY",
159161
"WASM",

pandas/compat/_constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
IS64 = sys.maxsize > 2**32
1515

1616
PY312 = sys.version_info >= (3, 12)
17+
PY314 = sys.version_info >= (3, 14)
1718
PYPY = platform.python_implementation() == "PyPy"
1819
WASM = (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"])
1920
ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "")
@@ -23,6 +24,7 @@
2324
"IS64",
2425
"ISMUSL",
2526
"PY312",
27+
"PY314",
2628
"PYPY",
2729
"WASM",
2830
]

pandas/core/arrays/sparse/accessor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,10 @@ def to_coo(self) -> spmatrix:
440440
rows.append(row)
441441
data.append(sp_arr.sp_values.astype(dtype, copy=False))
442442

443-
cols = np.concatenate(cols)
444-
rows = np.concatenate(rows)
445-
data = np.concatenate(data)
446-
return coo_matrix((data, (rows, cols)), shape=self._parent.shape)
443+
cols_arr = np.concatenate(cols)
444+
rows_arr = np.concatenate(rows)
445+
data_arr = np.concatenate(data)
446+
return coo_matrix((data_arr, (rows_arr, cols_arr)), shape=self._parent.shape)
447447

448448
@property
449449
def density(self) -> float:

pandas/core/arrays/sparse/array.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,26 @@
9292
Sequence,
9393
)
9494
from enum import Enum
95+
from typing import (
96+
Protocol,
97+
type_check_only,
98+
)
9599

96100
class ellipsis(Enum):
97101
Ellipsis = "..."
98102

99103
Ellipsis = ellipsis.Ellipsis
100104

101-
from scipy.sparse import spmatrix
105+
from scipy.sparse import (
106+
csc_array,
107+
csc_matrix,
108+
)
109+
110+
@type_check_only
111+
class _SparseMatrixLike(Protocol):
112+
@property
113+
def shape(self, /) -> tuple[int, int]: ...
114+
def tocsc(self, /) -> csc_array | csc_matrix: ...
102115

103116
from pandas._typing import NumpySorter
104117

@@ -120,6 +133,7 @@ class ellipsis(Enum):
120133

121134
from pandas import Series
122135

136+
123137
else:
124138
ellipsis = type(Ellipsis)
125139

@@ -511,7 +525,7 @@ def _simple_new(
511525
return new
512526

513527
@classmethod
514-
def from_spmatrix(cls, data: spmatrix) -> Self:
528+
def from_spmatrix(cls, data: _SparseMatrixLike) -> Self:
515529
"""
516530
Create a SparseArray from a scipy.sparse matrix.
517531
@@ -543,10 +557,10 @@ def from_spmatrix(cls, data: spmatrix) -> Self:
543557

544558
# our sparse index classes require that the positions be strictly
545559
# increasing. So we need to sort loc, and arr accordingly.
546-
data = data.tocsc()
547-
data.sort_indices()
548-
arr = data.data
549-
idx = data.indices
560+
data_csc = data.tocsc()
561+
data_csc.sort_indices()
562+
arr = data_csc.data
563+
idx = data_csc.indices
550564

551565
zero = np.array(0, dtype=arr.dtype).item()
552566
dtype = SparseDtype(arr.dtype, zero)
@@ -1217,10 +1231,7 @@ def _concat_same_type(cls, to_concat: Sequence[Self]) -> Self:
12171231

12181232
data = np.concatenate(values)
12191233
indices_arr = np.concatenate(indices)
1220-
# error: Argument 2 to "IntIndex" has incompatible type
1221-
# "ndarray[Any, dtype[signedinteger[_32Bit]]]";
1222-
# expected "Sequence[int]"
1223-
sp_index = IntIndex(length, indices_arr) # type: ignore[arg-type]
1234+
sp_index = IntIndex(length, indices_arr)
12241235

12251236
else:
12261237
# when concatenating block indices, we don't claim that you'll

pandas/core/frame.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9374,6 +9374,9 @@ def update(
93749374
)
93759375
)
93769376
@Appender(_shared_docs["groupby"] % _shared_doc_kwargs)
9377+
@deprecate_nonkeyword_arguments(
9378+
Pandas4Warning, allowed_args=["self", "by", "level"], name="groupby"
9379+
)
93779380
def groupby(
93789381
self,
93799382
by=None,

pandas/core/series.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,9 @@ def _set_name(
19611961
)
19621962
)
19631963
@Appender(_shared_docs["groupby"] % _shared_doc_kwargs)
1964+
@deprecate_nonkeyword_arguments(
1965+
Pandas4Warning, allowed_args=["self", "by", "level"], name="groupby"
1966+
)
19641967
def groupby(
19651968
self,
19661969
by=None,

0 commit comments

Comments
 (0)