Skip to content

Commit d1f00f3

Browse files
bashtageKevin Sheppard
and
Kevin Sheppard
authored
MAINT: Bump pandas to 1.5.0 (#317)
* MAINT: Bump pandas to 1.5.0 * MAINT: Remove deprecated argument * MAINT: Remove deprecated argument * MAINT: Remove deprecated argument * MAINT: Remove deprecated argument, add missing * MAINT: Remove deprecated argument, add missing * MAINT: Remove deprecated argument, add missing * MAINT: Remove deprecated argument, add missing * MAINT: Remove deprecated argument, add missing * MAINT: Remove deprecated argument * MAINT: Remove deprecated argument * MAINT: Remove deprecated argument * MAINT: Fix errors created by deprecations * TST: Update tests for 1.5 * TST: Fix issues due to changes in tests * CLN: Final cleanups for 1.5.x compat * MAINT: Implement remaining deprecations * MAINT: Fix small typing issues * REV: Revery changes to factorize * MAINT: Remove properties from ExcelWriter * ENH: Add new argument to resample * CLN: Remove __array__wrap__ * ENH: Add numeric_only to windowing * ENH: Add styler changes * REV: Revertexcel deletions * REV: Revert groupby changes * CLN: Remove older deprecated code * BUG: Fix rsplit type when expand is True Co-authored-by: Kevin Sheppard <[email protected]>
1 parent 873b8a2 commit d1f00f3

40 files changed

+282
-456
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-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def unique(values: ExtensionArray) -> ExtensionArray: ...
2626
def factorize(
2727
values: Any,
2828
sort: bool = ...,
29-
na_sentinel: int | None = ...,
29+
# Not actually positional-only, used to handle deprecations in 1.5.0
30+
*,
3031
use_na_sentinel: bool = ...,
3132
size_hint: int | None = ...,
3233
) -> tuple[np.ndarray, np.ndarray | Index]: ...

pandas-stubs/core/arrays/base.pyi

+1-1
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): ...

pandas-stubs/core/arrays/categorical.pyi

+3-18
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
@@ -64,22 +62,9 @@ class Categorical(ExtensionArray, PandasObject):
6462
) -> Categorical: ...
6563
@property
6664
def codes(self) -> np_ndarray_int: ...
67-
@overload
68-
def set_ordered(self, value, inplace: Literal[True]) -> None: ...
69-
@overload
70-
def set_ordered(self, value, inplace: Literal[False] = ...) -> Categorical: ...
71-
@overload
72-
def set_ordered(self, value, inplace: bool = ...) -> Categorical | None: ...
73-
@overload
74-
def as_ordered(self, inplace: Literal[True]) -> None: ...
75-
@overload
76-
def as_ordered(self, inplace: Literal[False] = ...) -> Categorical: ...
77-
@overload
78-
def as_ordered(self, inplace: bool = ...) -> Categorical | None: ...
79-
@overload
80-
def as_unordered(self, inplace: Literal[True]) -> None: ...
81-
@overload
82-
def as_unordered(self, inplace: Literal[False] = ...) -> Categorical: ...
65+
def set_ordered(self, value) -> Categorical: ...
66+
def as_ordered(self) -> Categorical: ...
67+
def as_unordered(self) -> Categorical: ...
8368
@overload
8469
def set_categories(
8570
self, new_categories, ordered=..., rename: bool = ..., *, inplace: Literal[True]

pandas-stubs/core/base.pyi

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ from pandas._typing import (
1717
npt,
1818
)
1919

20-
# TODO: These two moved to pandas.errors after switch to 1.5.x
21-
class DataError(Exception): ...
22-
class SpecificationError(Exception): ...
23-
2420
class PandasObject(DirNamesMixin):
2521
def __sizeof__(self) -> int: ...
2622

@@ -80,13 +76,11 @@ class IndexOpsMixin:
8076
@property
8177
def is_unique(self) -> bool: ...
8278
@property
83-
def is_monotonic(self) -> bool: ...
84-
@property
8579
def is_monotonic_decreasing(self) -> bool: ...
8680
@property
8781
def is_monotonic_increasing(self) -> bool: ...
8882
def factorize(
89-
self, sort: bool = ..., na_sentinel: int = ...
83+
self, sort: bool = ...
9084
) -> tuple[np.ndarray, np.ndarray | Index | Categorical]: ...
9185
def searchsorted(
9286
self, value, side: Literal["left", "right"] = ..., sorter=...

pandas-stubs/core/common.pyi

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ from typing import (
55

66
from pandas._typing import T
77

8-
# TODO: Remove from here after 1.5.x is target, moved to pandas.errors
9-
class SettingWithCopyError(ValueError): ...
10-
class SettingWithCopyWarning(Warning): ...
11-
128
def flatten(line) -> None: ...
139
def consensus_name_attr(objs): ...
1410
def is_bool_indexer(key) -> bool: ...

pandas-stubs/core/computation/engines.pyi

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import abc
22

3-
# TODO: Remove from here after 1.5.x, moved to pandas.errors
4-
class NumExprClobberingError(NameError): ...
5-
63
class AbstractEngine(metaclass=abc.ABCMeta):
74
has_neg_frac: bool = ...
85
expr = ...

pandas-stubs/core/frame.pyi

+31-52
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ class DataFrame(NDFrame, OpsMixin):
206206
@property
207207
def style(self) -> Styler: ...
208208
def items(self) -> Iterable[tuple[Hashable, Series]]: ...
209-
def iteritems(self) -> Iterable[tuple[Label, Series]]: ...
210209
def iterrows(self) -> Iterable[tuple[Label, Series]]: ...
211210
def itertuples(self, index: _bool = ..., name: _str | None = ...): ...
212211
def __len__(self) -> int: ...
@@ -292,6 +291,7 @@ class DataFrame(NDFrame, OpsMixin):
292291
def to_stata(
293292
self,
294293
path: FilePath | WriteBuffer[bytes],
294+
*,
295295
convert_dates: dict[HashableT, StataDateFormat] | None = ...,
296296
write_index: _bool = ...,
297297
byteorder: Literal["<", ">", "little", "big"] | None = ...,
@@ -302,7 +302,6 @@ class DataFrame(NDFrame, OpsMixin):
302302
convert_strl: list[HashableT] | None = ...,
303303
compression: CompressionOptions = ...,
304304
storage_options: StorageOptions = ...,
305-
*,
306305
value_labels: dict[Hashable, dict[float, str]] | None = ...,
307306
) -> None: ...
308307
def to_feather(self, path: FilePath | WriteBuffer[bytes], **kwargs) -> None: ...
@@ -1018,6 +1017,7 @@ class DataFrame(NDFrame, OpsMixin):
10181017
) -> _DataFrameGroupByNonScalar: ...
10191018
def pivot(
10201019
self,
1020+
*,
10211021
index: IndexLabel = ...,
10221022
columns: IndexLabel = ...,
10231023
values: IndexLabel = ...,
@@ -1124,14 +1124,18 @@ class DataFrame(NDFrame, OpsMixin):
11241124
self,
11251125
method: Literal["pearson", "kendall", "spearman"] = ...,
11261126
min_periods: int = ...,
1127+
numeric_only: _bool = ...,
1128+
) -> DataFrame: ...
1129+
def cov(
1130+
self, min_periods: int | None = ..., ddof: int = ..., numeric_only: _bool = ...
11271131
) -> DataFrame: ...
1128-
def cov(self, min_periods: int | None = ..., ddof: int = ...) -> DataFrame: ...
11291132
def corrwith(
11301133
self,
11311134
other: DataFrame | Series,
11321135
axis: AxisType | None = ...,
11331136
drop: _bool = ...,
11341137
method: Literal["pearson", "kendall", "spearman"] = ...,
1138+
numeric_only: _bool = ...,
11351139
) -> Series: ...
11361140
@overload
11371141
def count(
@@ -1142,8 +1146,12 @@ class DataFrame(NDFrame, OpsMixin):
11421146
self, axis: AxisType = ..., level: None = ..., numeric_only: _bool = ...
11431147
) -> Series: ...
11441148
def nunique(self, axis: AxisType = ..., dropna: bool = ...) -> Series: ...
1145-
def idxmax(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
1146-
def idxmin(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
1149+
def idxmax(
1150+
self, axis: AxisType = ..., skipna: _bool = ..., numeric_only: _bool = ...
1151+
) -> Series: ...
1152+
def idxmin(
1153+
self, axis: AxisType = ..., skipna: _bool = ..., numeric_only: _bool = ...
1154+
) -> Series: ...
11471155
@overload
11481156
def mode(
11491157
self,
@@ -1296,6 +1304,7 @@ class DataFrame(NDFrame, OpsMixin):
12961304
@overload
12971305
def any(
12981306
self,
1307+
*,
12991308
axis: None,
13001309
bool_only: _bool | None = ...,
13011310
skipna: _bool = ...,
@@ -1304,6 +1313,7 @@ class DataFrame(NDFrame, OpsMixin):
13041313
@overload
13051314
def any(
13061315
self,
1316+
*,
13071317
axis: AxisType = ...,
13081318
bool_only: _bool | None = ...,
13091319
skipna: _bool = ...,
@@ -1521,15 +1531,15 @@ class DataFrame(NDFrame, OpsMixin):
15211531
axis: AxisType | None = ...,
15221532
skipna: _bool | None = ...,
15231533
level: None = ...,
1524-
numeric_only: _bool | None = ...,
1534+
numeric_only: _bool = ...,
15251535
**kwargs,
15261536
) -> Series: ...
15271537
def kurtosis(
15281538
self,
15291539
axis: AxisType | None = ...,
15301540
skipna: _bool | None = ...,
15311541
level: None = ...,
1532-
numeric_only: _bool | None = ...,
1542+
numeric_only: _bool = ...,
15331543
**kwargs,
15341544
) -> Series: ...
15351545
def last(self, offset) -> DataFrame: ...
@@ -1540,62 +1550,46 @@ class DataFrame(NDFrame, OpsMixin):
15401550
def lt(
15411551
self, other, axis: AxisType = ..., level: Level | None = ...
15421552
) -> DataFrame: ...
1543-
@overload
1544-
def mad(
1545-
self,
1546-
axis: AxisType | None = ...,
1547-
skipna: _bool | None = ...,
1548-
level: None = ...,
1549-
) -> Series: ...
1550-
@overload
1551-
def mad(
1552-
self,
1553-
axis: AxisType | None = ...,
1554-
skipna: _bool | None = ...,
1555-
*,
1556-
level: Level,
1557-
**kwargs,
1558-
) -> DataFrame: ...
15591553
def mask(
15601554
self,
15611555
cond: Series | DataFrame | np.ndarray,
15621556
other=...,
15631557
inplace: _bool = ...,
15641558
axis: AxisType | None = ...,
15651559
level: Level | None = ...,
1566-
errors: _str = ...,
1560+
*, # Not actually positional-only, but needed due to depr in 1.5.0
15671561
try_cast: _bool = ...,
15681562
) -> DataFrame: ...
15691563
def max(
15701564
self,
15711565
axis: AxisType | None = ...,
15721566
skipna: _bool | None = ...,
15731567
level: None = ...,
1574-
numeric_only: _bool | None = ...,
1568+
numeric_only: _bool = ...,
15751569
**kwargs,
15761570
) -> Series: ...
15771571
def mean(
15781572
self,
15791573
axis: AxisType | None = ...,
15801574
skipna: _bool | None = ...,
15811575
level: None = ...,
1582-
numeric_only: _bool | None = ...,
1576+
numeric_only: _bool = ...,
15831577
**kwargs,
15841578
) -> Series: ...
15851579
def median(
15861580
self,
15871581
axis: AxisType | None = ...,
15881582
skipna: _bool | None = ...,
15891583
level: None = ...,
1590-
numeric_only: _bool | None = ...,
1584+
numeric_only: _bool = ...,
15911585
**kwargs,
15921586
) -> Series: ...
15931587
def min(
15941588
self,
15951589
axis: AxisType | None = ...,
15961590
skipna: _bool | None = ...,
15971591
level: None = ...,
1598-
numeric_only: _bool | None = ...,
1592+
numeric_only: _bool = ...,
15991593
**kwargs,
16001594
) -> Series: ...
16011595
def mod(
@@ -1649,7 +1643,7 @@ class DataFrame(NDFrame, OpsMixin):
16491643
axis: AxisType | None = ...,
16501644
skipna: _bool | None = ...,
16511645
level: None = ...,
1652-
numeric_only: _bool | None = ...,
1646+
numeric_only: _bool = ...,
16531647
min_count: int = ...,
16541648
**kwargs,
16551649
) -> Series: ...
@@ -1658,7 +1652,7 @@ class DataFrame(NDFrame, OpsMixin):
16581652
axis: AxisType | None = ...,
16591653
skipna: _bool = ...,
16601654
level: None = ...,
1661-
numeric_only: _bool | None = ...,
1655+
numeric_only: _bool = ...,
16621656
min_count: int = ...,
16631657
**kwargs,
16641658
) -> Series: ...
@@ -1828,32 +1822,17 @@ class DataFrame(NDFrame, OpsMixin):
18281822
skipna: _bool | None = ...,
18291823
level: None = ...,
18301824
ddof: int = ...,
1831-
numeric_only: _bool | None = ...,
1825+
numeric_only: _bool = ...,
18321826
**kwargs,
18331827
) -> Series: ...
1834-
@overload
1835-
def set_axis(
1836-
self, labels, inplace: Literal[True], axis: AxisType = ...
1837-
) -> None: ...
1838-
@overload
1839-
def set_axis(
1840-
self, labels, inplace: Literal[False], axis: AxisType = ...
1841-
) -> DataFrame: ...
1842-
@overload
1843-
def set_axis(self, labels, *, axis: AxisType = ...) -> DataFrame: ...
1844-
@overload
1845-
def set_axis(
1846-
self,
1847-
labels,
1848-
axis: AxisType = ...,
1849-
inplace: _bool | None = ...,
1850-
) -> DataFrame | None: ...
1828+
# Not actually positional, but used to handle removal of deprecated
1829+
def set_axis(self, labels, *, axis: AxisType, copy: _bool = ...) -> DataFrame: ...
18511830
def skew(
18521831
self,
18531832
axis: AxisType | None = ...,
18541833
skipna: _bool | None = ...,
18551834
level: None = ...,
1856-
numeric_only: _bool | None = ...,
1835+
numeric_only: _bool = ...,
18571836
**kwargs,
18581837
) -> Series: ...
18591838
def slice_shift(self, periods: int = ..., axis: AxisType = ...) -> DataFrame: ...
@@ -1886,7 +1865,7 @@ class DataFrame(NDFrame, OpsMixin):
18861865
axis: AxisType | None = ...,
18871866
skipna: _bool | None = ...,
18881867
level: None = ...,
1889-
numeric_only: _bool | None = ...,
1868+
numeric_only: _bool = ...,
18901869
min_count: int = ...,
18911870
**kwargs,
18921871
) -> Series: ...
@@ -2022,7 +2001,7 @@ class DataFrame(NDFrame, OpsMixin):
20222001
skipna: _bool | None = ...,
20232002
level: None = ...,
20242003
ddof: int = ...,
2025-
numeric_only: _bool | None = ...,
2004+
numeric_only: _bool = ...,
20262005
**kwargs,
20272006
) -> Series: ...
20282007
def where(
@@ -2036,7 +2015,7 @@ class DataFrame(NDFrame, OpsMixin):
20362015
inplace: _bool = ...,
20372016
axis: AxisType | None = ...,
20382017
level: Level | None = ...,
2039-
errors: _str = ...,
2018+
*, # Not actually positional-only, but needed due to depr in 1.5.0
20402019
try_cast: _bool = ...,
20412020
) -> DataFrame: ...
20422021
# Move from generic because Series is Generic and it returns Series[bool] there

0 commit comments

Comments
 (0)