Skip to content

Commit f1ba252

Browse files
author
Kevin Sheppard
committed
MAINT: Implement remaining deprecations
1 parent b781bbe commit f1ba252

File tree

16 files changed

+70
-169
lines changed

16 files changed

+70
-169
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

+25-55
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 (
@@ -294,6 +291,7 @@ class DataFrame(NDFrame, OpsMixin):
294291
def to_stata(
295292
self,
296293
path: FilePath | WriteBuffer[bytes],
294+
*,
297295
convert_dates: dict[HashableT, StataDateFormat] | None = ...,
298296
write_index: _bool = ...,
299297
byteorder: Literal["<", ">", "little", "big"] | None = ...,
@@ -304,7 +302,6 @@ class DataFrame(NDFrame, OpsMixin):
304302
convert_strl: list[HashableT] | None = ...,
305303
compression: CompressionOptions = ...,
306304
storage_options: StorageOptions = ...,
307-
*,
308305
value_labels: dict[Hashable, dict[float, str]] | None = ...,
309306
) -> None: ...
310307
def to_feather(self, path: FilePath | WriteBuffer[bytes], **kwargs) -> None: ...
@@ -992,20 +989,6 @@ class DataFrame(NDFrame, OpsMixin):
992989
filter_func: Callable | None = ...,
993990
errors: IgnoreRaise = ...,
994991
) -> 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
1009992
def groupby(
1010993
self,
1011994
by: GroupByObjectNonScalar | None = ...,
@@ -1017,9 +1000,10 @@ class DataFrame(NDFrame, OpsMixin):
10171000
squeeze: _bool = ...,
10181001
observed: _bool = ...,
10191002
dropna: _bool = ...,
1020-
) -> _DataFrameGroupByNonScalar: ...
1003+
) -> DataFrameGroupBy: ...
10211004
def pivot(
10221005
self,
1006+
*,
10231007
index: IndexLabel = ...,
10241008
columns: IndexLabel = ...,
10251009
values: IndexLabel = ...,
@@ -1170,13 +1154,15 @@ class DataFrame(NDFrame, OpsMixin):
11701154
self,
11711155
q: float = ...,
11721156
axis: AxisType = ...,
1157+
numeric_only: _bool = ...,
11731158
interpolation: QuantileInterpolation = ...,
11741159
) -> Series: ...
11751160
@overload
11761161
def quantile(
11771162
self,
11781163
q: list[float] | np.ndarray,
11791164
axis: AxisType = ...,
1165+
numeric_only: _bool = ...,
11801166
interpolation: QuantileInterpolation = ...,
11811167
) -> DataFrame: ...
11821168
def to_timestamp(
@@ -1296,6 +1282,7 @@ class DataFrame(NDFrame, OpsMixin):
12961282
@overload
12971283
def any(
12981284
self,
1285+
*,
12991286
axis: None,
13001287
bool_only: _bool | None = ...,
13011288
skipna: _bool = ...,
@@ -1304,6 +1291,7 @@ class DataFrame(NDFrame, OpsMixin):
13041291
@overload
13051292
def any(
13061293
self,
1294+
*,
13071295
axis: AxisType = ...,
13081296
bool_only: _bool | None = ...,
13091297
skipna: _bool = ...,
@@ -1521,13 +1509,15 @@ class DataFrame(NDFrame, OpsMixin):
15211509
axis: AxisType | None = ...,
15221510
skipna: _bool | None = ...,
15231511
level: None = ...,
1512+
numeric_only: _bool = ...,
15241513
**kwargs,
15251514
) -> Series: ...
15261515
def kurtosis(
15271516
self,
15281517
axis: AxisType | None = ...,
15291518
skipna: _bool | None = ...,
15301519
level: None = ...,
1520+
numeric_only: _bool = ...,
15311521
**kwargs,
15321522
) -> Series: ...
15331523
def last(self, offset) -> DataFrame: ...
@@ -1538,58 +1528,46 @@ class DataFrame(NDFrame, OpsMixin):
15381528
def lt(
15391529
self, other, axis: AxisType = ..., level: Level | None = ...
15401530
) -> 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: ...
15571531
def mask(
15581532
self,
15591533
cond: Series | DataFrame | np.ndarray,
15601534
other=...,
15611535
inplace: _bool = ...,
15621536
axis: AxisType | None = ...,
15631537
level: Level | None = ...,
1564-
errors: _str = ...,
1538+
*, # Not actually positional-only, but needed due to depr in 1.5.0
15651539
try_cast: _bool = ...,
15661540
) -> DataFrame: ...
15671541
def max(
15681542
self,
15691543
axis: AxisType | None = ...,
15701544
skipna: _bool | None = ...,
15711545
level: None = ...,
1546+
numeric_only: _bool = ...,
15721547
**kwargs,
15731548
) -> Series: ...
15741549
def mean(
15751550
self,
15761551
axis: AxisType | None = ...,
15771552
skipna: _bool | None = ...,
15781553
level: None = ...,
1554+
numeric_only: _bool = ...,
15791555
**kwargs,
15801556
) -> Series: ...
15811557
def median(
15821558
self,
15831559
axis: AxisType | None = ...,
15841560
skipna: _bool | None = ...,
15851561
level: None = ...,
1562+
numeric_only: _bool = ...,
15861563
**kwargs,
15871564
) -> Series: ...
15881565
def min(
15891566
self,
15901567
axis: AxisType | None = ...,
15911568
skipna: _bool | None = ...,
15921569
level: None = ...,
1570+
numeric_only: _bool = ...,
15931571
**kwargs,
15941572
) -> Series: ...
15951573
def mod(
@@ -1643,6 +1621,7 @@ class DataFrame(NDFrame, OpsMixin):
16431621
axis: AxisType | None = ...,
16441622
skipna: _bool | None = ...,
16451623
level: None = ...,
1624+
numeric_only: _bool = ...,
16461625
min_count: int = ...,
16471626
**kwargs,
16481627
) -> Series: ...
@@ -1651,6 +1630,7 @@ class DataFrame(NDFrame, OpsMixin):
16511630
axis: AxisType | None = ...,
16521631
skipna: _bool = ...,
16531632
level: None = ...,
1633+
numeric_only: _bool = ...,
16541634
min_count: int = ...,
16551635
**kwargs,
16561636
) -> Series: ...
@@ -1820,30 +1800,17 @@ class DataFrame(NDFrame, OpsMixin):
18201800
skipna: _bool | None = ...,
18211801
level: None = ...,
18221802
ddof: int = ...,
1803+
numeric_only: _bool = ...,
18231804
**kwargs,
18241805
) -> 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: ...
1806+
# Not actually positional, but used to handle removal of deprecated
1807+
def set_axis(self, labels, *, axis: AxisType, copy: bool = ...) -> DataFrame: ...
18421808
def skew(
18431809
self,
18441810
axis: AxisType | None = ...,
18451811
skipna: _bool | None = ...,
18461812
level: None = ...,
1813+
numeric_only: _bool = ...,
18471814
**kwargs,
18481815
) -> Series: ...
18491816
def slice_shift(self, periods: int = ..., axis: AxisType = ...) -> DataFrame: ...
@@ -1854,6 +1821,7 @@ class DataFrame(NDFrame, OpsMixin):
18541821
skipna: _bool = ...,
18551822
level: None = ...,
18561823
ddof: int = ...,
1824+
numeric_only: _bool = ...,
18571825
**kwargs,
18581826
) -> Series: ...
18591827
def sub(
@@ -1875,6 +1843,7 @@ class DataFrame(NDFrame, OpsMixin):
18751843
axis: AxisType | None = ...,
18761844
skipna: _bool | None = ...,
18771845
level: None = ...,
1846+
numeric_only: _bool = ...,
18781847
min_count: int = ...,
18791848
**kwargs,
18801849
) -> Series: ...
@@ -2010,6 +1979,7 @@ class DataFrame(NDFrame, OpsMixin):
20101979
skipna: _bool | None = ...,
20111980
level: None = ...,
20121981
ddof: int = ...,
1982+
numeric_only: _bool = ...,
20131983
**kwargs,
20141984
) -> Series: ...
20151985
def where(
@@ -2023,7 +1993,7 @@ class DataFrame(NDFrame, OpsMixin):
20231993
inplace: _bool = ...,
20241994
axis: AxisType | None = ...,
20251995
level: Level | None = ...,
2026-
errors: _str = ...,
1996+
*, # Not actually positional-only, but needed due to depr in 1.5.0
20271997
try_cast: _bool = ...,
20281998
) -> DataFrame: ...
20291999
# Move from generic because Series is Generic and it returns Series[bool] there

pandas-stubs/core/generic.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
109109
startcol: int = ...,
110110
engine: _str | None = ...,
111111
merge_cells: _bool = ...,
112-
encoding: _str | None = ...,
112+
# Not actually positional, but used to handle removal of deprecated
113+
*,
113114
inf_rep: _str = ...,
114-
verbose: _bool = ...,
115115
freeze_panes: tuple[int, int] | None = ...,
116116
) -> None: ...
117117
def to_hdf(
@@ -248,7 +248,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
248248
compression: CompressionOptions = ...,
249249
quoting: CSVQuoting = ...,
250250
quotechar: _str = ...,
251-
line_terminator: _str | None = ...,
251+
lineterminator: _str | None = ...,
252252
chunksize: int | None = ...,
253253
date_format: _str | None = ...,
254254
doublequote: _bool = ...,
@@ -273,7 +273,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
273273
compression: CompressionOptions = ...,
274274
quoting: CSVQuoting = ...,
275275
quotechar: _str = ...,
276-
line_terminator: _str | None = ...,
276+
lineterminator: _str | None = ...,
277277
chunksize: int | None = ...,
278278
date_format: _str | None = ...,
279279
doublequote: _bool = ...,
@@ -445,7 +445,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
445445
inplace: _bool = ...,
446446
axis=...,
447447
level=...,
448-
errors: _str = ...,
448+
*, # Not actually positional-only, but needed due to depr in 1.5.0
449449
try_cast: _bool = ...,
450450
): ...
451451
def mask(
@@ -455,7 +455,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin):
455455
inplace: _bool = ...,
456456
axis=...,
457457
level=...,
458-
errors: IgnoreRaise = ...,
458+
*, # Not actually positional-only, but needed due to depr in 1.5.0
459459
try_cast: _bool = ...,
460460
): ...
461461
def shift(self, periods=..., freq=..., axis=..., fill_value=...) -> NDFrame: ...

0 commit comments

Comments
 (0)