diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index c9e6d9986..be2f2cdc9 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -142,7 +142,6 @@ class Timestamp(datetime): second: int | None = ..., microsecond: int | None = ..., tzinfo: _tzinfo | None = ..., - *, fold: Literal[0, 1] | None = ..., ) -> Timestamp: ... def astimezone(self: _DatetimeT, tz: _tzinfo | None = ...) -> _DatetimeT: ... diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index af56c0338..b06e4d590 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -42,8 +42,6 @@ def unique(values: ExtensionArray) -> ExtensionArray: ... def factorize( values: Sequence, sort: bool = ..., - # Not actually positional-only, used to handle deprecations in 1.5.0 - *, use_na_sentinel: bool = ..., size_hint: int | None = ..., ) -> tuple[np.ndarray, np.ndarray]: ... diff --git a/pandas-stubs/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi index 2ac8d2c0c..1c4c33c16 100644 --- a/pandas-stubs/core/arrays/base.pyi +++ b/pandas-stubs/core/arrays/base.pyi @@ -42,11 +42,9 @@ class ExtensionArray: ) -> ABCExtensionArray: ... def unique(self): ... def searchsorted(self, value, side: str = ..., sorter=...): ... + # TODO: remove keyword-only when pandas removed na_sentinel def factorize( - self, - # Not actually positional-only, used to handle deprecations in 1.5.0 - *, - use_na_sentinel: bool = ..., + self, *, use_na_sentinel: bool = ... ) -> tuple[np.ndarray, ABCExtensionArray]: ... def repeat(self, repeats, axis=...): ... def take( diff --git a/pandas-stubs/core/arrays/boolean.pyi b/pandas-stubs/core/arrays/boolean.pyi index 5a9e7ba60..b126a6b1e 100644 --- a/pandas-stubs/core/arrays/boolean.pyi +++ b/pandas-stubs/core/arrays/boolean.pyi @@ -25,5 +25,5 @@ class BooleanArray(BaseMaskedArray): def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... def __setitem__(self, key, value) -> None: ... def astype(self, dtype, copy: bool = ...): ... - def any(self, skipna: bool = ..., **kwargs): ... - def all(self, skipna: bool = ..., **kwargs): ... + def any(self, *, skipna: bool = ..., **kwargs): ... + def all(self, *, skipna: bool = ..., **kwargs): ... diff --git a/pandas-stubs/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi index 9b5f86985..8abc8da35 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -156,22 +156,22 @@ class Categorical(ExtensionArray, PandasObject): def dropna(self): ... def value_counts(self, dropna: bool = ...): ... def check_for_ordered(self, op) -> None: ... - def argsort(self, ascending: bool = ..., kind: str = ..., *args, **kwargs): ... + def argsort(self, *, ascending: bool = ..., kind: str = ..., **kwargs): ... def sort_values( - self, inplace: bool = ..., ascending: bool = ..., na_position: str = ... + self, *, inplace: bool = ..., ascending: bool = ..., na_position: str = ... ): ... def view(self, dtype=...): ... def to_dense(self): ... def fillna(self, value=..., method=..., limit=...): ... - def take(self, indexer, allow_fill: bool = ..., fill_value=...): ... + def take(self, indexer, *, allow_fill: bool = ..., fill_value=...): ... def take_nd(self, indexer, allow_fill: bool = ..., fill_value=...): ... def __len__(self) -> int: ... def __iter__(self): ... def __contains__(self, key) -> bool: ... def __getitem__(self, key): ... def __setitem__(self, key, value) -> None: ... - def min(self, skipna: bool = ...): ... - def max(self, skipna: bool = ...): ... + def min(self, *, skipna: bool = ...): ... + def max(self, *, skipna: bool = ...): ... def mode(self, dropna: bool = ...): ... def unique(self): ... def equals(self, other): ... diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index 06274319c..866b89fcd 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -40,7 +40,7 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def astype(self, dtype, copy: bool = ...): ... def view(self, dtype=...): ... def unique(self): ... - def take(self, indices, allow_fill: bool = ..., fill_value=...): ... + def take(self, indices, *, allow_fill: bool = ..., fill_value=...): ... def copy(self): ... def shift(self, periods: int = ..., fill_value=..., axis: int = ...): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @@ -77,8 +77,8 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def __rsub__(self, other): ... def __iadd__(self, other): ... def __isub__(self, other): ... - def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ... - def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ... - def mean(self, skipna: bool = ...): ... + def min(self, *, axis=..., skipna: bool = ..., **kwargs): ... + def max(self, *, axis=..., skipna: bool = ..., **kwargs): ... + def mean(self, *, skipna: bool = ...): ... def maybe_infer_freq(freq): ... diff --git a/pandas-stubs/core/arrays/masked.pyi b/pandas-stubs/core/arrays/masked.pyi index a1212531f..dccf64ddc 100644 --- a/pandas-stubs/core/arrays/masked.pyi +++ b/pandas-stubs/core/arrays/masked.pyi @@ -26,6 +26,6 @@ class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin): def isna(self): ... @property def nbytes(self) -> int: ... - def take(self, indexer, allow_fill: bool = ..., fill_value=...): ... + def take(self, indexer, *, allow_fill: bool = ..., fill_value=...): ... def copy(self): ... def value_counts(self, dropna: bool = ...): ... diff --git a/pandas-stubs/core/arrays/sparse/array.pyi b/pandas-stubs/core/arrays/sparse/array.pyi index c447b97a5..0e57b63b2 100644 --- a/pandas-stubs/core/arrays/sparse/array.pyi +++ b/pandas-stubs/core/arrays/sparse/array.pyi @@ -43,15 +43,11 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin): def shift(self, periods: int = ..., fill_value=...): ... def unique(self): ... def factorize( # type: ignore[override] - self, - na_sentinel: int = ..., - # Not actually positional-only, used to handle deprecations in 1.5.0 - *, - use_na_sentinel: bool = ..., + self, na_sentinel: int = ..., use_na_sentinel: bool = ... ) -> tuple[np.ndarray, SparseArray]: ... def value_counts(self, dropna: bool = ...): ... def __getitem__(self, key): ... - def take(self, indices, allow_fill: bool = ..., fill_value=...): ... + def take(self, indices, *, allow_fill: bool = ..., fill_value=...): ... def searchsorted(self, v, side: str = ..., sorter=...): ... def copy(self): ... def astype(self, dtype=..., copy: bool = ...): ... diff --git a/pandas-stubs/core/base.pyi b/pandas-stubs/core/base.pyi index b6fc6e165..213cc5d93 100644 --- a/pandas-stubs/core/base.pyi +++ b/pandas-stubs/core/base.pyi @@ -87,5 +87,5 @@ class IndexOpsMixin: self, value, side: Literal["left", "right"] = ..., sorter=... ) -> int | list[int]: ... def drop_duplicates( - self, keep: NaPosition | Literal[False] = ... + self, *, keep: NaPosition | Literal[False] = ... ) -> IndexOpsMixin: ... diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index ad4e2ed11..331579846 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -19,8 +19,6 @@ def eval( expr: str | BinOp, parser: Literal["pandas", "python"] = ..., engine: Literal["python", "numexpr"] | None = ..., - # Keyword only due to omitted deprecated argument - *, local_dict: dict[str, Any] | None = ..., global_dict: dict[str, Any] | None = ..., resolvers: list[Mapping] | None = ..., diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 40dee71f1..80f20b883 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -519,7 +519,7 @@ class DataFrame(NDFrame, OpsMixin): def query( self, expr: _str, *, inplace: Literal[False] = ..., **kwargs ) -> DataFrame: ... - def eval(self, expr: _str, inplace: _bool = ..., **kwargs): ... + def eval(self, expr: _str, *, inplace: _bool = ..., **kwargs): ... def select_dtypes( self, include: _str | list[_str] | None = ..., @@ -639,28 +639,29 @@ class DataFrame(NDFrame, OpsMixin): def fillna( self, value: Scalar | NAType | dict | Series | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: AxisType | None = ..., limit: int = ..., downcast: dict | None = ..., - *, inplace: Literal[True], ) -> None: ... @overload def fillna( self, value: Scalar | NAType | dict | Series | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: AxisType | None = ..., limit: int = ..., downcast: dict | None = ..., - *, inplace: Literal[False] = ..., ) -> DataFrame: ... @overload def fillna( self, value: Scalar | NAType | dict | Series | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: AxisType | None = ..., inplace: _bool | None = ..., @@ -672,10 +673,10 @@ class DataFrame(NDFrame, OpsMixin): self, to_replace=..., value: Scalar | NAType | Sequence | Mapping | Pattern | None = ..., + *, limit: int | None = ..., regex=..., method: ReplaceMethod = ..., - *, inplace: Literal[True], ) -> None: ... @overload @@ -683,6 +684,7 @@ class DataFrame(NDFrame, OpsMixin): self, to_replace=..., value: Scalar | NAType | Sequence | Mapping | Pattern | None = ..., + *, inplace: Literal[False] = ..., limit: int | None = ..., regex=..., @@ -693,6 +695,7 @@ class DataFrame(NDFrame, OpsMixin): self, to_replace=..., value: Scalar | NAType | Sequence | Mapping | Pattern | None = ..., + *, inplace: _bool | None = ..., limit: int | None = ..., regex=..., @@ -714,10 +717,10 @@ class DataFrame(NDFrame, OpsMixin): | np.ndarray | Iterator[HashableT] | list[HashableT], + *, drop: _bool = ..., append: _bool = ..., verify_integrity: _bool = ..., - *, inplace: Literal[True], ) -> None: ... @overload @@ -729,33 +732,20 @@ class DataFrame(NDFrame, OpsMixin): | np.ndarray | Iterator[HashableT] | list[HashableT], - drop: _bool = ..., - append: _bool = ..., - verify_integrity: _bool = ..., *, - inplace: Literal[False], - ) -> DataFrame: ... - @overload - def set_index( - self, - keys: Label - | Series - | Index - | np.ndarray - | Iterator[HashableT] - | list[HashableT], drop: _bool = ..., append: _bool = ..., verify_integrity: _bool = ..., + inplace: Literal[False] = ..., ) -> DataFrame: ... @overload def reset_index( self, level: Level | Sequence[Level] = ..., + *, drop: _bool = ..., col_level: int | _str = ..., col_fill: Hashable = ..., - *, inplace: Literal[True], allow_duplicates: _bool = ..., names: Hashable | list[HashableT] = ..., @@ -764,22 +754,11 @@ class DataFrame(NDFrame, OpsMixin): def reset_index( self, level: Level | Sequence[Level] = ..., - drop: _bool = ..., - col_level: int | _str = ..., - col_fill: Hashable = ..., - *, - inplace: Literal[False], - allow_duplicates: _bool = ..., - names: Hashable | list[HashableT] = ..., - ) -> DataFrame: ... - @overload - def reset_index( - self, - level: Level | Sequence[Level] = ..., - drop: _bool = ..., *, col_level: int | _str = ..., col_fill: Hashable = ..., + drop: _bool = ..., + inplace: Literal[False] = ..., allow_duplicates: _bool = ..., names: Hashable | list[HashableT] = ..., ) -> DataFrame: ... @@ -787,6 +766,7 @@ class DataFrame(NDFrame, OpsMixin): def reset_index( self, level: Level | Sequence[Level] = ..., + *, drop: _bool = ..., inplace: _bool | None = ..., col_level: int | _str = ..., @@ -801,34 +781,27 @@ class DataFrame(NDFrame, OpsMixin): @overload def dropna( self, + *, axis: AxisType = ..., how: Literal["any", "all"] = ..., thresh: int | None = ..., subset: list | None = ..., - *, inplace: Literal[True], ) -> None: ... @overload def dropna( self, - axis: AxisType = ..., - how: Literal["any", "all"] = ..., - thresh: int | None = ..., - subset: list | None = ..., *, - inplace: Literal[False], - ) -> DataFrame: ... - @overload - def dropna( - self, axis: AxisType = ..., how: Literal["any", "all"] = ..., thresh: int | None = ..., subset: list | None = ..., + inplace: Literal[False] = ..., ) -> DataFrame: ... @overload def dropna( self, + *, axis: AxisType = ..., how: Literal["any", "all"] = ..., thresh: int | None = ..., @@ -838,6 +811,7 @@ class DataFrame(NDFrame, OpsMixin): def drop_duplicates( self, subset=..., + *, keep: NaPosition | _bool = ..., inplace: _bool = ..., ignore_index: _bool = ..., @@ -851,12 +825,12 @@ class DataFrame(NDFrame, OpsMixin): def sort_values( self, by: _str | Sequence[_str], + *, axis: AxisType = ..., ascending: _bool | Sequence[_bool] = ..., kind: SortKind = ..., na_position: NaPosition = ..., ignore_index: _bool = ..., - *, inplace: Literal[True], key: Callable | None = ..., ) -> None: ... @@ -864,31 +838,20 @@ class DataFrame(NDFrame, OpsMixin): def sort_values( self, by: _str | Sequence[_str], - axis: AxisType = ..., - ascending: _bool | Sequence[_bool] = ..., - kind: SortKind = ..., - na_position: NaPosition = ..., - ignore_index: _bool = ..., *, - inplace: Literal[False], - key: Callable | None = ..., - ) -> DataFrame: ... - @overload - def sort_values( - self, - by: _str | Sequence[_str], axis: AxisType = ..., ascending: _bool | Sequence[_bool] = ..., - *, kind: SortKind = ..., na_position: NaPosition = ..., ignore_index: _bool = ..., + inplace: Literal[False] = ..., key: Callable | None = ..., ) -> DataFrame: ... @overload def sort_values( self, by: _str | Sequence[_str], + *, axis: AxisType = ..., ascending: _bool | Sequence[_bool] = ..., inplace: _bool | None = ..., @@ -900,6 +863,7 @@ class DataFrame(NDFrame, OpsMixin): @overload def sort_index( self, + *, axis: AxisType = ..., level: Level | None = ..., ascending: _bool | Sequence[_bool] = ..., @@ -907,40 +871,27 @@ class DataFrame(NDFrame, OpsMixin): na_position: NaPosition = ..., sort_remaining: _bool = ..., ignore_index: _bool = ..., - *, inplace: Literal[True], key: Callable | None = ..., ) -> None: ... @overload def sort_index( self, - axis: AxisType = ..., - level: Level | list[int] | list[_str] | None = ..., - ascending: _bool | Sequence[_bool] = ..., - kind: SortKind = ..., - na_position: NaPosition = ..., - sort_remaining: _bool = ..., - ignore_index: _bool = ..., *, - inplace: Literal[False], - key: Callable | None = ..., - ) -> DataFrame: ... - @overload - def sort_index( - self, axis: AxisType = ..., level: Level | list[int] | list[_str] | None = ..., ascending: _bool | Sequence[_bool] = ..., - *, kind: SortKind = ..., na_position: NaPosition = ..., sort_remaining: _bool = ..., ignore_index: _bool = ..., + inplace: Literal[False] = ..., key: Callable | None = ..., ) -> DataFrame: ... @overload def sort_index( self, + *, axis: AxisType = ..., level: Level | list[int] | list[_str] | None = ..., ascending: _bool | Sequence[_bool] = ..., @@ -1491,8 +1442,8 @@ class DataFrame(NDFrame, OpsMixin): @overload def bfill( self, - axis: AxisType | None = ..., *, + axis: AxisType | None = ..., inplace: Literal[True], limit: int | None = ..., downcast: dict | None = ..., @@ -1500,8 +1451,8 @@ class DataFrame(NDFrame, OpsMixin): @overload def bfill( self, - axis: AxisType | None = ..., *, + axis: AxisType | None = ..., inplace: Literal[False] = ..., limit: int | None = ..., downcast: dict | None = ..., @@ -1510,9 +1461,9 @@ class DataFrame(NDFrame, OpsMixin): self, lower: float | None = ..., upper: float | None = ..., + *, axis: AxisType | None = ..., inplace: _bool = ..., - *args, **kwargs, ) -> DataFrame: ... def copy(self, deep: _bool = ...) -> DataFrame: ... @@ -1576,8 +1527,8 @@ class DataFrame(NDFrame, OpsMixin): @overload def ffill( self, - axis: AxisType | None = ..., *, + axis: AxisType | None = ..., inplace: Literal[True], limit: int | None = ..., downcast: dict | None = ..., @@ -1585,8 +1536,8 @@ class DataFrame(NDFrame, OpsMixin): @overload def ffill( self, - axis: AxisType | None = ..., *, + axis: AxisType | None = ..., inplace: Literal[False] = ..., limit: int | None = ..., downcast: dict | None = ..., @@ -1623,12 +1574,12 @@ class DataFrame(NDFrame, OpsMixin): def interpolate( self, method: _str = ..., + *, axis: AxisType = ..., limit: int | None = ..., limit_direction: Literal["forward", "backward", "both"] = ..., limit_area: Literal["inside", "outside"] | None = ..., downcast: Literal["infer"] | None = ..., - *, inplace: Literal[True], **kwargs, ) -> None: ... @@ -1636,12 +1587,12 @@ class DataFrame(NDFrame, OpsMixin): def interpolate( self, method: _str = ..., + *, axis: AxisType = ..., limit: int | None = ..., limit_direction: Literal["forward", "backward", "both"] = ..., limit_area: Literal["inside", "outside"] | None = ..., downcast: Literal["infer"] | None = ..., - *, inplace: Literal[False], **kwargs, ) -> DataFrame: ... @@ -1649,16 +1600,7 @@ class DataFrame(NDFrame, OpsMixin): def interpolate( self, method: _str = ..., - axis: AxisType = ..., - limit: int | None = ..., - limit_direction: Literal["forward", "backward", "both"] = ..., - limit_area: Literal["inside", "outside"] | None = ..., - downcast: Literal["infer"] | None = ..., - ) -> DataFrame: ... - @overload - def interpolate( - self, - method: _str = ..., + *, axis: AxisType = ..., limit: int | None = ..., inplace: _bool | None = ..., @@ -1666,7 +1608,7 @@ class DataFrame(NDFrame, OpsMixin): limit_area: Literal["inside", "outside"] | None = ..., downcast: Literal["infer"] | None = ..., **kwargs, - ) -> DataFrame: ... + ) -> DataFrame | None: ... def keys(self) -> Index: ... def kurt( self, @@ -1696,10 +1638,10 @@ class DataFrame(NDFrame, OpsMixin): self, cond: Series | DataFrame | np.ndarray, other=..., + *, inplace: _bool = ..., axis: AxisType | None = ..., level: Level | None = ..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ) -> DataFrame: ... def max( @@ -1833,37 +1775,37 @@ class DataFrame(NDFrame, OpsMixin): def rename_axis( self, mapper=..., - *, - inplace: Literal[True], axis: AxisType | None = ..., copy: _bool = ..., + *, + inplace: Literal[True], ) -> None: ... @overload def rename_axis( self, mapper=..., - *, - inplace: Literal[False] = ..., axis: AxisType | None = ..., copy: _bool = ..., + *, + inplace: Literal[False] = ..., ) -> DataFrame: ... @overload def rename_axis( self, - *, - inplace: Literal[True], index: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ..., columns: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ..., copy: _bool = ..., + *, + inplace: Literal[True], ) -> None: ... @overload def rename_axis( self, - *, - inplace: Literal[False] = ..., index: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ..., columns: _str | Sequence[_str] | dict[_str | int, _str] | Callable | None = ..., copy: _bool = ..., + *, + inplace: Literal[False] = ..., ) -> DataFrame: ... def resample( self, @@ -1873,8 +1815,6 @@ class DataFrame(NDFrame, OpsMixin): label: _str | None = ..., convention: TimestampConvention = ..., kind: Literal["timestamp", "period"] | None = ..., - # Not actually positional but needed due to deprecations - *, on: _str | None = ..., level: Level | None = ..., origin: Timestamp @@ -1909,13 +1849,13 @@ class DataFrame(NDFrame, OpsMixin): window: int | str | BaseOffset | BaseIndexer, min_periods: int | None = ..., center: _bool = ..., - *, - win_type: _str, on: Hashable | None = ..., axis: AxisType = ..., closed: IntervalClosedType | None = ..., step: int | None = ..., method: CalculationMethod = ..., + *, + win_type: _str, ) -> Window[DataFrame]: ... @overload def rolling( @@ -1923,13 +1863,13 @@ class DataFrame(NDFrame, OpsMixin): window: int | str | BaseOffset | BaseIndexer, min_periods: int | None = ..., center: _bool = ..., - *, - win_type: None = ..., on: Hashable | None = ..., axis: AxisType = ..., closed: IntervalClosedType | None = ..., step: int | None = ..., method: CalculationMethod = ..., + *, + win_type: None = ..., ) -> Rolling[DataFrame]: ... def rpow( self, @@ -2160,10 +2100,10 @@ class DataFrame(NDFrame, OpsMixin): | Callable[[DataFrame], DataFrame] | Callable[[Any], _bool], other=..., + *, inplace: _bool = ..., axis: AxisType | None = ..., level: Level | None = ..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ) -> DataFrame: ... # Move from generic because Series is Generic and it returns Series[bool] there diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 0b1b89c17..c2bd67a4a 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -109,8 +109,6 @@ class NDFrame(PandasObject, indexing.IndexingMixin): startcol: int = ..., engine: _str | None = ..., merge_cells: _bool = ..., - # Not actually positional, but used to handle removal of deprecated - *, inf_rep: _str = ..., freeze_panes: tuple[int, int] | None = ..., ) -> None: ... @@ -346,6 +344,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin): def add_suffix(self, suffix: _str) -> NDFrame: ... def sort_index( self, + *, axis: Literal["columns", "index", 0, 1] = ..., level=..., ascending: _bool = ..., @@ -393,6 +392,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin): def fillna( self, value=..., + *, method=..., axis=..., inplace: _bool = ..., @@ -403,6 +403,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin): self, to_replace=..., value=..., + *, inplace: _bool = ..., limit=..., regex: _bool = ..., @@ -414,7 +415,7 @@ class NDFrame(PandasObject, indexing.IndexingMixin): def notna(self) -> NDFrame: ... def notnull(self) -> NDFrame: ... def clip( - self, lower=..., upper=..., axis=..., inplace: _bool = ..., *args, **kwargs + self, lower=..., upper=..., *, axis=..., inplace: _bool = ..., **kwargs ) -> NDFrame: ... def asfreq( self, @@ -446,20 +447,20 @@ class NDFrame(PandasObject, indexing.IndexingMixin): self, cond, other=..., + *, inplace: _bool = ..., axis=..., level=..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ): ... def mask( self, cond, other=..., + *, inplace: _bool = ..., axis=..., level=..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ): ... def shift(self, periods=..., freq=..., axis=..., fill_value=...) -> NDFrame: ... diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index 8c3b8171a..64635d186 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -40,22 +40,6 @@ class BaseGroupBy(PandasObject, SelectionMixin[NDFrameT]): axis = ... grouper = ... exclusions = ... - def __init__( - self, - obj: NDFrame, - keys: KeysArgType | None = ..., - axis: int = ..., - level=..., - grouper: ops.BaseGrouper | None = ..., - exclusions=..., - selection=..., - as_index: bool = ..., - sort: bool = ..., - group_keys: bool = ..., - squeeze: bool = ..., - observed: bool = ..., - mutated: bool = ..., - ) -> None: ... def __len__(self) -> int: ... @property def groups(self) -> dict[Hashable, list[Hashable]]: ... diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index e18a8dffd..8aecdf508 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -101,7 +101,7 @@ class Index(IndexOpsMixin, PandasObject): def names(self) -> list[_str]: ... @names.setter def names(self, names: list[_str]): ... - def set_names(self, names, level=..., inplace: bool = ...): ... + def set_names(self, names, *, level=..., inplace: bool = ...): ... def rename(self, name, inplace: bool = ...): ... @property def nlevels(self) -> int: ... @@ -138,7 +138,7 @@ class Index(IndexOpsMixin, PandasObject): def dropna(self, how: Literal["any", "all"] = ...) -> Index: ... def unique(self, level=...) -> Index: ... def drop_duplicates( - self, keep: NaPosition | Literal[False] = ... + self, *, keep: NaPosition | Literal[False] = ... ) -> IndexOpsMixin: ... def duplicated( self, keep: Literal["first", "last", False] = ... @@ -215,7 +215,7 @@ class Index(IndexOpsMixin, PandasObject): def slice_locs(self, start=..., end=..., step=...): ... def delete(self, loc): ... def insert(self, loc, item): ... - def drop(self, labels, *, errors: _str = ...) -> Index: ... + def drop(self, labels, errors: _str = ...) -> Index: ... @property def shape(self) -> tuple[int, ...]: ... # Extra methods from old stubs diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index 71dae2792..dc66aa0fc 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -31,4 +31,6 @@ class DatetimeIndexOpsMixin(ExtensionIndex): class DatetimeTimedeltaMixin(DatetimeIndexOpsMixin, Int64Index): def difference(self, other, sort=...): ... def intersection(self, other, sort: bool = ...): ... - def join(self, other, how: str = ..., level=..., return_indexers=..., sort=...): ... + def join( + self, other, *, how: str = ..., level=..., return_indexers=..., sort=... + ): ... diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index c296a4a7a..0acbe8218 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -53,14 +53,10 @@ class MultiIndex(Index): def shape(self): ... @property # Should be read-only def levels(self) -> list[Index]: ... - def set_levels( - self, levels, level=..., inplace: bool = ..., verify_integrity: bool = ... - ): ... + def set_levels(self, levels, *, level=..., verify_integrity: bool = ...): ... @property def codes(self): ... - def set_codes( - self, codes, level=..., inplace: bool = ..., verify_integrity: bool = ... - ): ... + def set_codes(self, codes, *, level=..., verify_integrity: bool = ...): ... def copy(self, names=..., deep: bool = ...) -> MultiIndex: ... def __array__(self, dtype=...) -> np.ndarray: ... def view(self, cls=...): ... @@ -117,7 +113,7 @@ class MultiIndex(Index): def argsort(self, *args, **kwargs): ... def repeat(self, repeats, axis=...): ... def where(self, cond, other=...) -> None: ... - def drop(self, codes, *, level=..., errors: str = ...) -> MultiIndex: ... + def drop(self, codes, level=..., errors: str = ...) -> MultiIndex: ... # type: ignore[override] def swaplevel(self, i: int = ..., j: int = ...): ... def reorder_levels(self, order): ... def sortlevel( diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 53ce95277..f8a4ef3b1 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -54,6 +54,7 @@ class PeriodIndex(DatetimeIndexOpsMixin, Int64Index): def join( self, other, + *, how: str = ..., level=..., return_indexers: bool = ..., diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 86c12bc90..fcddbf527 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -54,17 +54,14 @@ class RangeIndex(Int64Index): def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ... def argsort(self, *args, **kwargs): ... def factorize( - self, - sort: bool = ..., - # Not actually positional-only, used to handle deprecations in 1.5.0 - *, - use_na_sentinel: bool = ..., + self, sort: bool = ..., use_na_sentinel: bool = ... ) -> tuple[npt.NDArray[np.intp], RangeIndex]: ... def equals(self, other): ... def intersection(self, other, sort: bool = ...): ... def join( self, other, + *, how: str = ..., level=..., return_indexers: bool = ..., diff --git a/pandas-stubs/core/resample.pyi b/pandas-stubs/core/resample.pyi index 548c3cd12..14d6dff3f 100644 --- a/pandas-stubs/core/resample.pyi +++ b/pandas-stubs/core/resample.pyi @@ -146,9 +146,9 @@ class Resampler(BaseGroupBy, Generic[NDFrameT]): def interpolate( self, method: _Interpolation = ..., + *, axis: AxisType = ..., limit: int | None = ..., - *, inplace: Literal[True], limit_direction: Literal["forward", "backward", "both"] = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -159,6 +159,7 @@ class Resampler(BaseGroupBy, Generic[NDFrameT]): def interpolate( self, method: _Interpolation = ..., + *, axis: AxisType = ..., limit: int | None = ..., inplace: Literal[False] = ..., diff --git a/pandas-stubs/core/reshape/concat.pyi b/pandas-stubs/core/reshape/concat.pyi index 7fc977a5e..4ca0fd064 100644 --- a/pandas-stubs/core/reshape/concat.pyi +++ b/pandas-stubs/core/reshape/concat.pyi @@ -21,6 +21,7 @@ from pandas._typing import ( @overload def concat( objs: Iterable[DataFrame] | Mapping[HashableT1, DataFrame], + *, axis: Literal[0, "index"] = ..., join: Literal["inner", "outer"] = ..., ignore_index: bool = ..., @@ -34,6 +35,7 @@ def concat( @overload def concat( objs: Iterable[Series] | Mapping[HashableT1, Series], + *, axis: Literal[0, "index"] = ..., join: Literal["inner", "outer"] = ..., ignore_index: bool = ..., @@ -47,6 +49,7 @@ def concat( @overload def concat( objs: Iterable[Series | DataFrame] | Mapping[HashableT1, Series | DataFrame], + *, axis: Literal[1, "columns"], join: Literal["inner", "outer"] = ..., ignore_index: bool = ..., diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 0aa7c2063..a2dddfc64 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -309,64 +309,67 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): def index(self) -> Index | MultiIndex: ... @index.setter def index(self, idx: Index) -> None: ... + # TODO: combine Level | Sequence[Level] github.com/python/mypy/issues/14311 @overload def reset_index( self, - level: Sequence[Level] | None, - drop: Literal[True], + level: Sequence[Level] = ..., *, - name: object | None = ..., - inplace: _bool = ..., + drop: Literal[False] = ..., + name: Level = ..., + inplace: Literal[False] = ..., allow_duplicates: bool = ..., - ) -> Series[S1]: ... + ) -> DataFrame: ... @overload def reset_index( self, - level: Level | None, - drop: Literal[True], + level: Sequence[Level] = ..., *, - name: object | None = ..., - inplace: _bool = ..., + drop: Literal[True], + name: Level = ..., + inplace: Literal[False] = ..., allow_duplicates: bool = ..., ) -> Series[S1]: ... @overload def reset_index( self, - /, - drop: Literal[True], - level: Sequence[Level] | None = ..., - name: object | None = ..., - inplace: _bool = ..., + level: Sequence[Level] = ..., + *, + drop: bool = ..., + name: Level = ..., + inplace: Literal[True], allow_duplicates: bool = ..., - ) -> Series[S1]: ... + ) -> None: ... @overload def reset_index( self, - /, - drop: Literal[True], level: Level | None = ..., - name: object | None = ..., - inplace: _bool = ..., + *, + drop: Literal[False] = ..., + name: Level = ..., + inplace: Literal[False] = ..., allow_duplicates: bool = ..., - ) -> Series[S1]: ... + ) -> DataFrame: ... @overload def reset_index( self, - level: Sequence[Level] | None = ..., - drop: Literal[False] = ..., - name: object | None = ..., - inplace: _bool = ..., + level: Level | None = ..., + *, + drop: Literal[True], + name: Level = ..., + inplace: Literal[False] = ..., allow_duplicates: bool = ..., - ) -> DataFrame: ... + ) -> Series[S1]: ... @overload def reset_index( self, level: Level | None = ..., - drop: Literal[False] = ..., - name: object | None = ..., - inplace: _bool = ..., + *, + drop: bool = ..., + name: Level = ..., + inplace: Literal[True], allow_duplicates: bool = ..., - ) -> DataFrame: ... + ) -> None: ... @overload def to_string( self, @@ -480,17 +483,15 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): def unique(self) -> np.ndarray: ... @overload def drop_duplicates( - self, keep: NaPosition | Literal[False] = ..., inplace: Literal[False] = ... + self, *, keep: NaPosition | Literal[False] = ..., inplace: Literal[False] = ... ) -> Series[S1]: ... @overload def drop_duplicates( - self, keep: NaPosition | Literal[False], inplace: Literal[True] + self, *, keep: NaPosition | Literal[False] = ..., inplace: Literal[True] ) -> None: ... @overload - def drop_duplicates(self, *, inplace: Literal[True]) -> None: ... - @overload def drop_duplicates( - self, keep: NaPosition | Literal[False] = ..., inplace: bool = ... + self, *, keep: NaPosition | Literal[False] = ..., inplace: bool = ... ) -> Series[S1] | None: ... def duplicated(self, keep: NaPosition | Literal[False] = ...) -> Series[_bool]: ... def idxmax( @@ -605,6 +606,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def sort_index( self, + *, axis: AxisType = ..., level: Level | None = ..., ascending: _bool | Sequence[_bool] = ..., @@ -612,13 +614,13 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): na_position: NaPosition = ..., sort_remaining: _bool = ..., ignore_index: _bool = ..., - *, inplace: Literal[True], key: Callable | None = ..., ) -> None: ... @overload def sort_index( self, + *, axis: AxisType = ..., level: Level | list[int] | list[_str] | None = ..., ascending: _bool | Sequence[_bool] = ..., @@ -626,13 +628,13 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): na_position: NaPosition = ..., sort_remaining: _bool = ..., ignore_index: _bool = ..., - *, inplace: Literal[False] = ..., key: Callable | None = ..., ) -> Series: ... @overload def sort_index( self, + *, axis: AxisType = ..., level: Level | list[int] | list[_str] | None = ..., ascending: _bool | Sequence[_bool] = ..., @@ -820,27 +822,29 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): def fillna( self, value: Scalar | NAType | dict | Series[S1] | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: SeriesAxisType = ..., limit: int | None = ..., downcast: dict | None = ..., - *, inplace: Literal[True], ) -> None: ... @overload def fillna( self, value: Scalar | NAType | dict | Series[S1] | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: SeriesAxisType = ..., - *, limit: int | None = ..., downcast: dict | None = ..., + inplace: Literal[False] = ..., ) -> Series[S1]: ... @overload def fillna( self, value: Scalar | NAType | dict | Series[S1] | DataFrame | None = ..., + *, method: FillnaOptions | None = ..., axis: SeriesAxisType = ..., inplace: _bool = ..., @@ -852,6 +856,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): self, to_replace: _str | list | dict | Series[S1] | float | None = ..., value: Scalar | NAType | dict | list | _str | None = ..., + *, inplace: Literal[False] = ..., limit: int | None = ..., regex=..., @@ -862,10 +867,10 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): self, to_replace: _str | list | dict | Series[S1] | float | None = ..., value: Scalar | NAType | dict | list | _str | None = ..., + *, limit: int | None = ..., regex=..., method: ReplaceMethod = ..., - *, inplace: Literal[True], ) -> None: ... @overload @@ -873,6 +878,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): self, to_replace: _str | list | dict | Series[S1] | float | None = ..., value: Scalar | NAType | dict | list | _str | None = ..., + *, inplace: _bool = ..., limit: int | None = ..., regex=..., @@ -900,18 +906,27 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def dropna( self, - axis: SeriesAxisType = ..., - how: Literal["any", "all"] | None = ..., *, + axis: SeriesAxisType = ..., inplace: Literal[True], + how: Literal["any", "all"] | None = ..., ) -> None: ... @overload def dropna( self, + *, axis: SeriesAxisType = ..., - inplace: _bool = ..., + inplace: Literal[False] = ..., how: Literal["any", "all"] | None = ..., ) -> Series[S1]: ... + @overload + def dropna( + self, + *, + axis: SeriesAxisType = ..., + inplace: _bool = ..., + how: Literal["any", "all"] | None = ..., + ) -> Series[S1] | None: ... def to_timestamp( self, freq=..., @@ -998,8 +1013,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def ffill( self, - axis: SeriesAxisType | None = ..., *, + axis: SeriesAxisType | None = ..., inplace: Literal[True], limit: int | None = ..., downcast: dict | None = ..., @@ -1007,8 +1022,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def ffill( self, - axis: SeriesAxisType | None = ..., *, + axis: SeriesAxisType | None = ..., inplace: Literal[False] = ..., limit: int | None = ..., downcast: dict | None = ..., @@ -1016,8 +1031,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def bfill( self, - axis: SeriesAxisType | None = ..., *, + axis: SeriesAxisType | None = ..., inplace: Literal[True], limit: int | None = ..., downcast: dict | None = ..., @@ -1025,8 +1040,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def bfill( self, - axis: SeriesAxisType | None = ..., *, + axis: SeriesAxisType | None = ..., inplace: Literal[False] = ..., limit: int | None = ..., downcast: dict | None = ..., @@ -1034,6 +1049,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): @overload def bfill( self, + *, value: S1 | dict | Series[S1] | DataFrame, axis: SeriesAxisType = ..., inplace: _bool = ..., @@ -1063,6 +1079,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): "akima", "from_derivatives", ] = ..., + *, axis: SeriesAxisType | None = ..., limit: int | None = ..., inplace: _bool = ..., @@ -1080,9 +1097,9 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): self, lower: AnyArrayLike | float | None = ..., upper: AnyArrayLike | float | None = ..., + *, axis: SeriesAxisType | None = ..., inplace: _bool = ..., - *args, **kwargs, ) -> Series[S1]: ... def asfreq( @@ -1140,20 +1157,20 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): | Callable[[Series[S1]], Series[bool]] | Callable[[S1], bool], other=..., + *, inplace: _bool = ..., axis: SeriesAxisType | None = ..., level: Level | None = ..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ) -> Series[S1]: ... def mask( self, cond: MaskType, other: Scalar | Series[S1] | DataFrame | Callable = ..., + *, inplace: _bool = ..., axis: SeriesAxisType | None = ..., level: Level | None = ..., - *, # Not actually positional-only, but needed due to depr in 1.5.0 try_cast: _bool = ..., ) -> Series[S1]: ... def slice_shift( @@ -1613,13 +1630,13 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): window: int | _str | BaseOffset | BaseIndexer, min_periods: int | None = ..., center: _bool = ..., - *, - win_type: _str, on: _str | None = ..., axis: SeriesAxisType = ..., closed: IntervalClosedType | None = ..., step: int | None = ..., method: CalculationMethod = ..., + *, + win_type: _str, ) -> Window[Series]: ... @overload def rolling( @@ -1627,13 +1644,13 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): window: int | _str | BaseOffset | BaseIndexer, min_periods: int | None = ..., center: _bool = ..., - *, - win_type: None = ..., on: _str | None = ..., axis: SeriesAxisType = ..., closed: IntervalClosedType | None = ..., step: int | None = ..., method: CalculationMethod = ..., + *, + win_type: None = ..., ) -> Rolling[Series]: ... def rpow( self, @@ -1751,8 +1768,9 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): copy: _bool = ..., inplace: Literal[False] = ..., ) -> Series: ... - # Not actually positional, but used to handle removal of deprecated - def set_axis(self, labels, axis: Axis = ..., copy: _bool = ...) -> Series[S1]: ... + def set_axis( + self, labels, *, axis: Axis = ..., copy: _bool = ... + ) -> Series[S1]: ... def __iter__(self) -> Iterator[S1]: ... class TimestampSeries(Series[Timestamp]): diff --git a/pandas-stubs/io/html.pyi b/pandas-stubs/io/html.pyi index d5b9892a1..9bf05108a 100644 --- a/pandas-stubs/io/html.pyi +++ b/pandas-stubs/io/html.pyi @@ -22,6 +22,7 @@ from pandas._typing import ( def read_html( io: FilePath | ReadBuffer[str], + *, match: str | Pattern = ..., flavor: str | None = ..., header: int | Sequence[int] | None = ..., diff --git a/pandas-stubs/io/json/_json.pyi b/pandas-stubs/io/json/_json.pyi index de8694400..198054e71 100644 --- a/pandas-stubs/io/json/_json.pyi +++ b/pandas-stubs/io/json/_json.pyi @@ -93,6 +93,7 @@ def read_json( @overload def read_json( path_or_buf: FilePath | ReadBuffer[str] | ReadBuffer[bytes], + *, orient: JsonFrameOrient | None = ..., typ: Literal["frame"] = ..., dtype: bool | dict[HashableT, DtypeArg] | None = ..., diff --git a/pandas-stubs/io/parsers/readers.pyi b/pandas-stubs/io/parsers/readers.pyi index 01f99e18c..c63606654 100644 --- a/pandas-stubs/io/parsers/readers.pyi +++ b/pandas-stubs/io/parsers/readers.pyi @@ -429,10 +429,10 @@ def read_table( @overload def read_fwf( filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str], + *, colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ..., widths: Sequence[int] | None = ..., infer_nrows: int = ..., - *, iterator: Literal[True], chunksize: int | None = ..., **kwds: Any, @@ -440,10 +440,10 @@ def read_fwf( @overload def read_fwf( filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str], + *, colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ..., widths: Sequence[int] | None = ..., infer_nrows: int = ..., - *, iterator: bool = ..., chunksize: int, **kwds: Any, @@ -451,10 +451,10 @@ def read_fwf( @overload def read_fwf( filepath_or_buffer: FilePath | ReadCsvBuffer[bytes] | ReadCsvBuffer[str], + *, colspecs: Sequence[tuple[int, int]] | Literal["infer"] | None = ..., widths: Sequence[int] | None = ..., infer_nrows: int = ..., - *, iterator: Literal[False] = ..., chunksize: None = ..., **kwds: Any, diff --git a/pandas-stubs/io/sas/sasreader.pyi b/pandas-stubs/io/sas/sasreader.pyi index 1a7b0f136..6800d19db 100644 --- a/pandas-stubs/io/sas/sasreader.pyi +++ b/pandas-stubs/io/sas/sasreader.pyi @@ -30,10 +30,10 @@ class ReaderBase(metaclass=ABCMeta): @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: Literal["sas7bdat"], index: Hashable | None = ..., encoding: str | None = ..., - *, chunksize: int, iterator: bool = ..., compression: CompressionOptions = ..., @@ -41,10 +41,10 @@ def read_sas( @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: Literal["xport"], index: Hashable | None = ..., encoding: str | None = ..., - *, chunksize: int, iterator: bool = ..., compression: CompressionOptions = ..., @@ -52,10 +52,10 @@ def read_sas( @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: None = ..., index: Hashable | None = ..., encoding: str | None = ..., - *, chunksize: int, iterator: bool = ..., compression: CompressionOptions = ..., @@ -63,39 +63,40 @@ def read_sas( @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: Literal["sas7bdat"], index: Hashable | None = ..., encoding: str | None = ..., chunksize: int | None = ..., - *, iterator: Literal[True], compression: CompressionOptions = ..., ) -> SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: Literal["xport"], index: Hashable | None = ..., encoding: str | None = ..., chunksize: int | None = ..., - *, iterator: Literal[True], compression: CompressionOptions = ..., ) -> XportReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int | None = ..., - *, iterator: Literal[True], compression: CompressionOptions = ..., ) -> XportReader | SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], + *, format: Literal["xport", "sas7bdat"] | None = ..., index: Hashable | None = ..., encoding: str | None = ..., diff --git a/tests/test_series.py b/tests/test_series.py index 12beb716d..05ca07d48 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -876,6 +876,7 @@ def test_reset_index() -> None: check(assert_type(r5, pd.Series), pd.Series) r6 = s.reset_index(["ab"], drop=True, allow_duplicates=True) check(assert_type(r6, pd.Series), pd.Series) + assert assert_type(s.reset_index(inplace=True, drop=True), None) is None def test_series_add_str() -> None: