Skip to content

Commit 68ef1c2

Browse files
Kevin Sheppardbashtage
Kevin Sheppard
authored andcommitted
MAINT: Implement remaining deprecations
1 parent b781bbe commit 68ef1c2

File tree

17 files changed

+100
-183
lines changed

17 files changed

+100
-183
lines changed

pandas-stubs/_config/config.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class DisplayUnicode(DictWrapper):
4747
class Display(DictWrapper):
4848
chop_threshold: int | None
4949
colheader_justify: str
50-
column_space: int
5150
date_dayfirst: bool
5251
date_yearfirst: bool
5352
encoding: str

pandas-stubs/core/algorithms.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def unique(values: ExtensionArray) -> ExtensionArray: ...
2626
def factorize(
2727
values: Any,
2828
sort: bool = ...,
29+
# Not actually positional-only, used to handle deprecations in 1.5.0
30+
*,
2931
use_na_sentinel: bool = ...,
3032
size_hint: int | None = ...,
3133
) -> tuple[np.ndarray, np.ndarray | Index]: ...

pandas-stubs/core/arrays/base.pyi

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ExtensionArray:
3333
def astype(self, dtype, copy: bool = ...): ...
3434
def isna(self) -> ArrayLike: ...
3535
def argsort(
36-
self, ascending: bool = ..., kind: str = ..., *args, **kwargs
36+
self, *, ascending: bool = ..., kind: str = ..., **kwargs
3737
) -> np.ndarray: ...
3838
def fillna(self, value=..., method=..., limit=...): ...
3939
def dropna(self): ...
@@ -43,7 +43,10 @@ class ExtensionArray:
4343
def unique(self): ...
4444
def searchsorted(self, value, side: str = ..., sorter=...): ...
4545
def factorize(
46-
self, na_sentinel: int = ...
46+
self,
47+
# Not actually positional-only, used to handle deprecations in 1.5.0
48+
*,
49+
use_na_sentinel: bool = ...,
4750
) -> tuple[np.ndarray, ABCExtensionArray]: ...
4851
def repeat(self, repeats, axis=...): ...
4952
def take(

pandas-stubs/core/arrays/categorical.pyi

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ class Categorical(ExtensionArray, PandasObject):
4242
) -> None: ...
4343
@property
4444
def categories(self): ...
45-
@categories.setter
46-
def categories(self, categories) -> None: ...
4745
@property
4846
def ordered(self) -> Ordered: ...
4947
@property

pandas-stubs/core/arrays/sparse/array.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
4242
def fillna(self, value=..., method=..., limit=...): ...
4343
def shift(self, periods: int = ..., fill_value=...): ...
4444
def unique(self): ...
45-
def factorize(self, na_sentinel: int = ...): ...
45+
# Not actually positional-only, used to handle deprecations in 1.5.0
46+
def factorize(self, *, use_na_sentinal: bool = ...): ...
4647
def value_counts(self, dropna: bool = ...): ...
4748
def __getitem__(self, key): ...
4849
def take(self, indices, allow_fill: bool = ..., fill_value=...): ...

pandas-stubs/core/frame.pyi

+36-59
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ from pandas import (
2222
)
2323
from pandas.core.arraylike import OpsMixin
2424
from pandas.core.generic import NDFrame
25-
from pandas.core.groupby.generic import (
26-
_DataFrameGroupByNonScalar,
27-
_DataFrameGroupByScalar,
28-
)
25+
from pandas.core.groupby.generic import DataFrameGroupBy
2926
from pandas.core.groupby.grouper import Grouper
3027
from pandas.core.indexes.base import Index
3128
from pandas.core.indexing import (
@@ -208,7 +205,6 @@ class DataFrame(NDFrame, OpsMixin):
208205
@property
209206
def style(self) -> Styler: ...
210207
def items(self) -> Iterable[tuple[Hashable, Series]]: ...
211-
def iteritems(self) -> Iterable[tuple[Label, Series]]: ...
212208
def iterrows(self) -> Iterable[tuple[Label, Series]]: ...
213209
def itertuples(self, index: _bool = ..., name: _str | None = ...): ...
214210
def __len__(self) -> int: ...
@@ -294,6 +290,7 @@ class DataFrame(NDFrame, OpsMixin):
294290
def to_stata(
295291
self,
296292
path: FilePath | WriteBuffer[bytes],
293+
*,
297294
convert_dates: dict[HashableT, StataDateFormat] | None = ...,
298295
write_index: _bool = ...,
299296
byteorder: Literal["<", ">", "little", "big"] | None = ...,
@@ -304,7 +301,6 @@ class DataFrame(NDFrame, OpsMixin):
304301
convert_strl: list[HashableT] | None = ...,
305302
compression: CompressionOptions = ...,
306303
storage_options: StorageOptions = ...,
307-
*,
308304
value_labels: dict[Hashable, dict[float, str]] | None = ...,
309305
) -> None: ...
310306
def to_feather(self, path: FilePath | WriteBuffer[bytes], **kwargs) -> None: ...
@@ -992,20 +988,6 @@ class DataFrame(NDFrame, OpsMixin):
992988
filter_func: Callable | None = ...,
993989
errors: IgnoreRaise = ...,
994990
) -> None: ...
995-
@overload
996-
def groupby(
997-
self,
998-
by: Scalar,
999-
axis: AxisType = ...,
1000-
level: Level | None = ...,
1001-
as_index: _bool = ...,
1002-
sort: _bool = ...,
1003-
group_keys: _bool = ...,
1004-
squeeze: _bool = ...,
1005-
observed: _bool = ...,
1006-
dropna: _bool = ...,
1007-
) -> _DataFrameGroupByScalar: ...
1008-
@overload
1009991
def groupby(
1010992
self,
1011993
by: GroupByObjectNonScalar | None = ...,
@@ -1017,9 +999,10 @@ class DataFrame(NDFrame, OpsMixin):
1017999
squeeze: _bool = ...,
10181000
observed: _bool = ...,
10191001
dropna: _bool = ...,
1020-
) -> _DataFrameGroupByNonScalar: ...
1002+
) -> DataFrameGroupBy: ...
10211003
def pivot(
10221004
self,
1005+
*,
10231006
index: IndexLabel = ...,
10241007
columns: IndexLabel = ...,
10251008
values: IndexLabel = ...,
@@ -1126,14 +1109,18 @@ class DataFrame(NDFrame, OpsMixin):
11261109
self,
11271110
method: Literal["pearson", "kendall", "spearman"] = ...,
11281111
min_periods: int = ...,
1112+
numeric_only: _bool = ...,
1113+
) -> DataFrame: ...
1114+
def cov(
1115+
self, min_periods: int | None = ..., ddof: int = ..., numeric_only: _bool = ...
11291116
) -> DataFrame: ...
1130-
def cov(self, min_periods: int | None = ..., ddof: int = ...) -> DataFrame: ...
11311117
def corrwith(
11321118
self,
11331119
other: DataFrame | Series,
11341120
axis: AxisType | None = ...,
11351121
drop: _bool = ...,
11361122
method: Literal["pearson", "kendall", "spearman"] = ...,
1123+
numeric_only: _bool = ...,
11371124
) -> Series: ...
11381125
@overload
11391126
def count(
@@ -1144,8 +1131,12 @@ class DataFrame(NDFrame, OpsMixin):
11441131
self, axis: AxisType = ..., level: None = ..., numeric_only: _bool = ...
11451132
) -> Series: ...
11461133
def nunique(self, axis: AxisType = ..., dropna: bool = ...) -> Series: ...
1147-
def idxmax(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
1148-
def idxmin(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
1134+
def idxmax(
1135+
self, axis: AxisType = ..., skipna: _bool = ..., numeric_only: _bool = ...
1136+
) -> Series: ...
1137+
def idxmin(
1138+
self, axis: AxisType = ..., skipna: _bool = ..., numeric_only: _bool = ...
1139+
) -> Series: ...
11491140
@overload
11501141
def mode(
11511142
self,
@@ -1170,13 +1161,15 @@ class DataFrame(NDFrame, OpsMixin):
11701161
self,
11711162
q: float = ...,
11721163
axis: AxisType = ...,
1164+
numeric_only: _bool = ...,
11731165
interpolation: QuantileInterpolation = ...,
11741166
) -> Series: ...
11751167
@overload
11761168
def quantile(
11771169
self,
11781170
q: list[float] | np.ndarray,
11791171
axis: AxisType = ...,
1172+
numeric_only: _bool = ...,
11801173
interpolation: QuantileInterpolation = ...,
11811174
) -> DataFrame: ...
11821175
def to_timestamp(
@@ -1296,6 +1289,7 @@ class DataFrame(NDFrame, OpsMixin):
12961289
@overload
12971290
def any(
12981291
self,
1292+
*,
12991293
axis: None,
13001294
bool_only: _bool | None = ...,
13011295
skipna: _bool = ...,
@@ -1304,6 +1298,7 @@ class DataFrame(NDFrame, OpsMixin):
13041298
@overload
13051299
def any(
13061300
self,
1301+
*,
13071302
axis: AxisType = ...,
13081303
bool_only: _bool | None = ...,
13091304
skipna: _bool = ...,
@@ -1521,13 +1516,15 @@ class DataFrame(NDFrame, OpsMixin):
15211516
axis: AxisType | None = ...,
15221517
skipna: _bool | None = ...,
15231518
level: None = ...,
1519+
numeric_only: _bool = ...,
15241520
**kwargs,
15251521
) -> Series: ...
15261522
def kurtosis(
15271523
self,
15281524
axis: AxisType | None = ...,
15291525
skipna: _bool | None = ...,
15301526
level: None = ...,
1527+
numeric_only: _bool = ...,
15311528
**kwargs,
15321529
) -> Series: ...
15331530
def last(self, offset) -> DataFrame: ...
@@ -1538,58 +1535,46 @@ class DataFrame(NDFrame, OpsMixin):
15381535
def lt(
15391536
self, other, axis: AxisType = ..., level: Level | None = ...
15401537
) -> DataFrame: ...
1541-
@overload
1542-
def mad(
1543-
self,
1544-
axis: AxisType | None = ...,
1545-
skipna: _bool | None = ...,
1546-
level: None = ...,
1547-
) -> Series: ...
1548-
@overload
1549-
def mad(
1550-
self,
1551-
axis: AxisType | None = ...,
1552-
skipna: _bool | None = ...,
1553-
*,
1554-
level: Level,
1555-
**kwargs,
1556-
) -> DataFrame: ...
15571538
def mask(
15581539
self,
15591540
cond: Series | DataFrame | np.ndarray,
15601541
other=...,
15611542
inplace: _bool = ...,
15621543
axis: AxisType | None = ...,
15631544
level: Level | None = ...,
1564-
errors: _str = ...,
1545+
*, # Not actually positional-only, but needed due to depr in 1.5.0
15651546
try_cast: _bool = ...,
15661547
) -> DataFrame: ...
15671548
def max(
15681549
self,
15691550
axis: AxisType | None = ...,
15701551
skipna: _bool | None = ...,
15711552
level: None = ...,
1553+
numeric_only: _bool = ...,
15721554
**kwargs,
15731555
) -> Series: ...
15741556
def mean(
15751557
self,
15761558
axis: AxisType | None = ...,
15771559
skipna: _bool | None = ...,
15781560
level: None = ...,
1561+
numeric_only: _bool = ...,
15791562
**kwargs,
15801563
) -> Series: ...
15811564
def median(
15821565
self,
15831566
axis: AxisType | None = ...,
15841567
skipna: _bool | None = ...,
15851568
level: None = ...,
1569+
numeric_only: _bool = ...,
15861570
**kwargs,
15871571
) -> Series: ...
15881572
def min(
15891573
self,
15901574
axis: AxisType | None = ...,
15911575
skipna: _bool | None = ...,
15921576
level: None = ...,
1577+
numeric_only: _bool = ...,
15931578
**kwargs,
15941579
) -> Series: ...
15951580
def mod(
@@ -1643,6 +1628,7 @@ class DataFrame(NDFrame, OpsMixin):
16431628
axis: AxisType | None = ...,
16441629
skipna: _bool | None = ...,
16451630
level: None = ...,
1631+
numeric_only: _bool = ...,
16461632
min_count: int = ...,
16471633
**kwargs,
16481634
) -> Series: ...
@@ -1651,6 +1637,7 @@ class DataFrame(NDFrame, OpsMixin):
16511637
axis: AxisType | None = ...,
16521638
skipna: _bool = ...,
16531639
level: None = ...,
1640+
numeric_only: _bool = ...,
16541641
min_count: int = ...,
16551642
**kwargs,
16561643
) -> Series: ...
@@ -1820,30 +1807,17 @@ class DataFrame(NDFrame, OpsMixin):
18201807
skipna: _bool | None = ...,
18211808
level: None = ...,
18221809
ddof: int = ...,
1810+
numeric_only: _bool = ...,
18231811
**kwargs,
18241812
) -> Series: ...
1825-
@overload
1826-
def set_axis(
1827-
self, labels, inplace: Literal[True], axis: AxisType = ...
1828-
) -> None: ...
1829-
@overload
1830-
def set_axis(
1831-
self, labels, inplace: Literal[False], axis: AxisType = ...
1832-
) -> DataFrame: ...
1833-
@overload
1834-
def set_axis(self, labels, *, axis: AxisType = ...) -> DataFrame: ...
1835-
@overload
1836-
def set_axis(
1837-
self,
1838-
labels,
1839-
axis: AxisType = ...,
1840-
inplace: _bool | None = ...,
1841-
) -> DataFrame | None: ...
1813+
# Not actually positional, but used to handle removal of deprecated
1814+
def set_axis(self, labels, *, axis: AxisType, copy: bool = ...) -> DataFrame: ...
18421815
def skew(
18431816
self,
18441817
axis: AxisType | None = ...,
18451818
skipna: _bool | None = ...,
18461819
level: None = ...,
1820+
numeric_only: _bool = ...,
18471821
**kwargs,
18481822
) -> Series: ...
18491823
def slice_shift(self, periods: int = ..., axis: AxisType = ...) -> DataFrame: ...
@@ -1854,6 +1828,7 @@ class DataFrame(NDFrame, OpsMixin):
18541828
skipna: _bool = ...,
18551829
level: None = ...,
18561830
ddof: int = ...,
1831+
numeric_only: _bool = ...,
18571832
**kwargs,
18581833
) -> Series: ...
18591834
def sub(
@@ -1875,6 +1850,7 @@ class DataFrame(NDFrame, OpsMixin):
18751850
axis: AxisType | None = ...,
18761851
skipna: _bool | None = ...,
18771852
level: None = ...,
1853+
numeric_only: _bool = ...,
18781854
min_count: int = ...,
18791855
**kwargs,
18801856
) -> Series: ...
@@ -2010,6 +1986,7 @@ class DataFrame(NDFrame, OpsMixin):
20101986
skipna: _bool | None = ...,
20111987
level: None = ...,
20121988
ddof: int = ...,
1989+
numeric_only: _bool = ...,
20131990
**kwargs,
20141991
) -> Series: ...
20151992
def where(
@@ -2023,7 +2000,7 @@ class DataFrame(NDFrame, OpsMixin):
20232000
inplace: _bool = ...,
20242001
axis: AxisType | None = ...,
20252002
level: Level | None = ...,
2026-
errors: _str = ...,
2003+
*, # Not actually positional-only, but needed due to depr in 1.5.0
20272004
try_cast: _bool = ...,
20282005
) -> DataFrame: ...
20292006
# Move from generic because Series is Generic and it returns Series[bool] there

0 commit comments

Comments
 (0)