Skip to content

Commit 0abb350

Browse files
authored
type args and kwargs as Any in frame.pyi (#1175)
1 parent 7328e89 commit 0abb350

File tree

1 file changed

+69
-57
lines changed

1 file changed

+69
-57
lines changed

pandas-stubs/core/frame.pyi

+69-57
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
476476
storage_options: StorageOptions = ...,
477477
value_labels: dict[Hashable, dict[float, str]] | None = ...,
478478
) -> None: ...
479-
def to_feather(self, path: FilePath | WriteBuffer[bytes], **kwargs) -> None: ...
479+
def to_feather(
480+
self, path: FilePath | WriteBuffer[bytes], **kwargs: Any
481+
) -> None: ...
480482
@overload
481483
def to_parquet(
482484
self,
@@ -669,14 +671,26 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
669671
) -> None: ...
670672
def __setitem__(self, key, value) -> None: ...
671673
@overload
672-
def query(self, expr: _str, *, inplace: Literal[True], **kwargs) -> None: ...
674+
def query(
675+
self,
676+
expr: _str,
677+
*,
678+
inplace: Literal[True],
679+
**kwargs: Any, # TODO: make more precise https://github.com/pandas-dev/pandas-stubs/issues/1173
680+
) -> None: ...
673681
@overload
674-
def query(self, expr: _str, *, inplace: Literal[False] = ..., **kwargs) -> Self: ...
682+
def query(
683+
self,
684+
expr: _str,
685+
*,
686+
inplace: Literal[False] = ...,
687+
**kwargs: Any, # TODO: make more precise https://github.com/pandas-dev/pandas-stubs/issues/1173
688+
) -> Self: ...
675689
@overload
676-
def eval(self, expr: _str, *, inplace: Literal[True], **kwargs) -> None: ...
690+
def eval(self, expr: _str, *, inplace: Literal[True], **kwargs: Any) -> None: ...
677691
@overload
678692
def eval(
679-
self, expr: _str, *, inplace: Literal[False] = ..., **kwargs
693+
self, expr: _str, *, inplace: Literal[False] = ..., **kwargs: Any
680694
) -> Scalar | np.ndarray | Self | Series: ...
681695
AstypeArgExt: TypeAlias = (
682696
AstypeArg
@@ -1277,32 +1291,38 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
12771291
def diff(self, periods: int = ..., axis: Axis = ...) -> Self: ...
12781292
@overload
12791293
def agg( # pyright: ignore[reportOverlappingOverload]
1280-
self, func: AggFuncTypeBase | AggFuncTypeDictSeries, axis: Axis = ..., **kwargs
1294+
self,
1295+
func: AggFuncTypeBase | AggFuncTypeDictSeries,
1296+
axis: Axis = ...,
1297+
**kwargs: Any,
12811298
) -> Series: ...
12821299
@overload
12831300
def agg(
12841301
self,
12851302
func: list[AggFuncTypeBase] | AggFuncTypeDictFrame = ...,
12861303
axis: Axis = ...,
1287-
**kwargs,
1304+
**kwargs: Any,
12881305
) -> Self: ...
12891306
@overload
12901307
def aggregate( # pyright: ignore[reportOverlappingOverload]
1291-
self, func: AggFuncTypeBase | AggFuncTypeDictSeries, axis: Axis = ..., **kwargs
1308+
self,
1309+
func: AggFuncTypeBase | AggFuncTypeDictSeries,
1310+
axis: Axis = ...,
1311+
**kwargs: Any,
12921312
) -> Series: ...
12931313
@overload
12941314
def aggregate(
12951315
self,
12961316
func: list[AggFuncTypeBase] | AggFuncTypeDictFrame,
12971317
axis: Axis = ...,
1298-
**kwargs,
1318+
**kwargs: Any,
12991319
) -> Self: ...
13001320
def transform(
13011321
self,
13021322
func: AggFuncTypeFrame,
13031323
axis: Axis = ...,
1304-
*args,
1305-
**kwargs,
1324+
*args: Any,
1325+
**kwargs: Any,
13061326
) -> Self: ...
13071327

13081328
# apply() overloads with default result_type of None, and is indifferent to axis
@@ -1450,7 +1470,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
14501470

14511471
# Add spacing between apply() overloads and remaining annotations
14521472
def map(
1453-
self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs
1473+
self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs: Any
14541474
) -> Self: ...
14551475
def join(
14561476
self,
@@ -1477,7 +1497,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
14771497
indicator: _bool | _str = ...,
14781498
validate: _str | None = ...,
14791499
) -> Self: ...
1480-
def round(self, decimals: int | dict | Series = ..., *args, **kwargs) -> Self: ...
1500+
def round(
1501+
self, decimals: int | dict | Series = ..., *args: Any, **kwargs: Any
1502+
) -> Self: ...
14811503
def corr(
14821504
self,
14831505
method: Literal["pearson", "kendall", "spearman"] = ...,
@@ -1510,24 +1532,11 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
15101532
def idxmin(
15111533
self, axis: Axis = ..., skipna: _bool = ..., numeric_only: _bool = ...
15121534
) -> Series: ...
1513-
@overload
15141535
def mode(
15151536
self,
15161537
axis: Axis = ...,
1517-
skipna: _bool = ...,
15181538
numeric_only: _bool = ...,
1519-
*,
1520-
level: Level,
1521-
**kwargs,
1522-
) -> Self: ...
1523-
@overload
1524-
def mode(
1525-
self,
1526-
axis: Axis = ...,
1527-
skipna: _bool = ...,
1528-
level: None = ...,
1529-
numeric_only: _bool = ...,
1530-
**kwargs,
1539+
dropna: _bool = ...,
15311540
) -> Series: ...
15321541
@overload
15331542
def quantile(
@@ -1576,7 +1585,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
15761585
layout: tuple[int, int] | None = ...,
15771586
bins: int | list = ...,
15781587
backend: _str | None = ...,
1579-
**kwargs,
1588+
**kwargs: Any,
15801589
): ...
15811590
def boxplot(
15821591
self,
@@ -1590,7 +1599,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
15901599
layout: tuple[int, int] | None = ...,
15911600
return_type: Literal["axes", "dict", "both"] | None = ...,
15921601
backend: _str | None = ...,
1593-
**kwargs,
1602+
**kwargs: Any,
15941603
): ...
15951604
sparse = ...
15961605

@@ -1649,15 +1658,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16491658
axis: None,
16501659
bool_only: _bool | None = ...,
16511660
skipna: _bool = ...,
1652-
**kwargs,
1661+
**kwargs: Any,
16531662
) -> _bool: ...
16541663
@overload
16551664
def all(
16561665
self,
16571666
axis: Axis = ...,
16581667
bool_only: _bool | None = ...,
16591668
skipna: _bool = ...,
1660-
**kwargs,
1669+
**kwargs: Any,
16611670
) -> Series[_bool]: ...
16621671
@overload
16631672
def any(
@@ -1666,7 +1675,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16661675
axis: None,
16671676
bool_only: _bool | None = ...,
16681677
skipna: _bool = ...,
1669-
**kwargs,
1678+
**kwargs: Any,
16701679
) -> _bool: ...
16711680
@overload
16721681
def any(
@@ -1675,7 +1684,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
16751684
axis: Axis = ...,
16761685
bool_only: _bool | None = ...,
16771686
skipna: _bool = ...,
1678-
**kwargs,
1687+
**kwargs: Any,
16791688
) -> Series[_bool]: ...
16801689
def asof(self, where, subset: _str | list[_str] | None = ...) -> Self: ...
16811690
def asfreq(
@@ -1730,7 +1739,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
17301739
*,
17311740
axis: Axis | None = ...,
17321741
inplace: Literal[True],
1733-
**kwargs,
1742+
**kwargs: Any,
17341743
) -> None: ...
17351744
@overload
17361745
def clip(
@@ -1740,20 +1749,20 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
17401749
*,
17411750
axis: Axis | None = ...,
17421751
inplace: Literal[False] = ...,
1743-
**kwargs,
1752+
**kwargs: Any,
17441753
) -> Self: ...
17451754
def copy(self, deep: _bool = ...) -> Self: ...
17461755
def cummax(
1747-
self, axis: Axis | None = ..., skipna: _bool = ..., *args, **kwargs
1756+
self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any
17481757
) -> Self: ...
17491758
def cummin(
1750-
self, axis: Axis | None = ..., skipna: _bool = ..., *args, **kwargs
1759+
self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any
17511760
) -> Self: ...
17521761
def cumprod(
1753-
self, axis: Axis | None = ..., skipna: _bool = ..., *args, **kwargs
1762+
self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any
17541763
) -> Self: ...
17551764
def cumsum(
1756-
self, axis: Axis | None = ..., skipna: _bool = ..., *args, **kwargs
1765+
self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any
17571766
) -> Self: ...
17581767
def describe(
17591768
self,
@@ -1854,7 +1863,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
18541863
limit_direction: Literal["forward", "backward", "both"] = ...,
18551864
limit_area: Literal["inside", "outside"] | None = ...,
18561865
inplace: Literal[True],
1857-
**kwargs,
1866+
**kwargs: Any,
18581867
) -> None: ...
18591868
@overload
18601869
def interpolate(
@@ -1866,7 +1875,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
18661875
limit_direction: Literal["forward", "backward", "both"] = ...,
18671876
limit_area: Literal["inside", "outside"] | None = ...,
18681877
inplace: Literal[False] = ...,
1869-
**kwargs,
1878+
**kwargs: Any,
18701879
) -> Self: ...
18711880
def keys(self) -> Index: ...
18721881
def kurt(
@@ -1875,15 +1884,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
18751884
skipna: _bool | None = ...,
18761885
level: None = ...,
18771886
numeric_only: _bool = ...,
1878-
**kwargs,
1887+
**kwargs: Any,
18791888
) -> Series: ...
18801889
def kurtosis(
18811890
self,
18821891
axis: Axis | None = ...,
18831892
skipna: _bool | None = ...,
18841893
level: None = ...,
18851894
numeric_only: _bool = ...,
1886-
**kwargs,
1895+
**kwargs: Any,
18871896
) -> Series: ...
18881897
def last(self, offset) -> Self: ...
18891898
def last_valid_index(self) -> Scalar: ...
@@ -1927,31 +1936,31 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
19271936
skipna: _bool | None = ...,
19281937
level: None = ...,
19291938
numeric_only: _bool = ...,
1930-
**kwargs,
1939+
**kwargs: Any,
19311940
) -> Series: ...
19321941
def mean(
19331942
self,
19341943
axis: Axis | None = ...,
19351944
skipna: _bool | None = ...,
19361945
level: None = ...,
19371946
numeric_only: _bool = ...,
1938-
**kwargs,
1947+
**kwargs: Any,
19391948
) -> Series: ...
19401949
def median(
19411950
self,
19421951
axis: Axis | None = ...,
19431952
skipna: _bool | None = ...,
19441953
level: None = ...,
19451954
numeric_only: _bool = ...,
1946-
**kwargs,
1955+
**kwargs: Any,
19471956
) -> Series: ...
19481957
def min(
19491958
self,
19501959
axis: Axis | None = ...,
19511960
skipna: _bool | None = ...,
19521961
level: None = ...,
19531962
numeric_only: _bool = ...,
1954-
**kwargs,
1963+
**kwargs: Any,
19551964
) -> Series: ...
19561965
def mod(
19571966
self,
@@ -1981,7 +1990,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
19811990
fill_method: None = ...,
19821991
limit: int | None = ...,
19831992
freq=...,
1984-
**kwargs,
1993+
**kwargs: Any, # TODO: make more precise https://github.com/pandas-dev/pandas-stubs/issues/1169
19851994
) -> Self: ...
19861995
def pop(self, item: _str) -> Series: ...
19871996
def pow(
@@ -1998,7 +2007,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
19982007
level: None = ...,
19992008
numeric_only: _bool = ...,
20002009
min_count: int = ...,
2001-
**kwargs,
2010+
**kwargs: Any,
20022011
) -> Series: ...
20032012
def product(
20042013
self,
@@ -2007,7 +2016,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20072016
level: None = ...,
20082017
numeric_only: _bool = ...,
20092018
min_count: int = ...,
2010-
**kwargs,
2019+
**kwargs: Any,
20112020
) -> Series: ...
20122021
def radd(
20132022
self,
@@ -2168,7 +2177,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21682177
level: None = ...,
21692178
ddof: int = ...,
21702179
numeric_only: _bool = ...,
2171-
**kwargs,
2180+
**kwargs: Any,
21722181
) -> Series: ...
21732182
# Not actually positional, but used to handle removal of deprecated
21742183
def set_axis(self, labels, *, axis: Axis, copy: _bool = ...) -> Self: ...
@@ -2178,7 +2187,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21782187
skipna: _bool | None = ...,
21792188
level: None = ...,
21802189
numeric_only: _bool = ...,
2181-
**kwargs,
2190+
**kwargs: Any,
21822191
) -> Series: ...
21832192
def squeeze(self, axis: Axis | None = ...): ...
21842193
def std(
@@ -2188,7 +2197,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21882197
level: None = ...,
21892198
ddof: int = ...,
21902199
numeric_only: _bool = ...,
2191-
**kwargs,
2200+
**kwargs: Any,
21922201
) -> Series: ...
21932202
def sub(
21942203
self,
@@ -2211,13 +2220,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
22112220
level: None = ...,
22122221
numeric_only: _bool = ...,
22132222
min_count: int = ...,
2214-
**kwargs,
2223+
**kwargs: Any,
22152224
) -> Series: ...
22162225
def swapaxes(self, axis1: Axis, axis2: Axis, copy: _bool = ...) -> Self: ...
22172226
def tail(self, n: int = ...) -> Self: ...
2218-
def take(self, indices: list, axis: Axis = ..., **kwargs) -> Self: ...
2227+
def take(self, indices: list, axis: Axis = ..., **kwargs: Any) -> Self: ...
22192228
def to_clipboard(
2220-
self, excel: _bool = ..., sep: _str | None = ..., **kwargs
2229+
self,
2230+
excel: _bool = ...,
2231+
sep: _str | None = ...,
2232+
**kwargs: Any, # TODO: make more precise https://github.com/pandas-dev/pandas-stubs/issues/1174
22212233
) -> None: ...
22222234
@overload
22232235
def to_json(
@@ -2377,7 +2389,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23772389
level: None = ...,
23782390
ddof: int = ...,
23792391
numeric_only: _bool = ...,
2380-
**kwargs,
2392+
**kwargs: Any,
23812393
) -> Series: ...
23822394
@overload
23832395
def where(

0 commit comments

Comments
 (0)