From 047e5d255b2c85fd0ddaefd44f649bfa56b079ab Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Sat, 26 Jul 2025 22:22:43 -0400 Subject: [PATCH 01/17] add defaults for parameters --- pandas-stubs/_libs/tslibs/nattype.pyi | 4 +- pandas-stubs/_libs/tslibs/timestamps.pyi | 8 +- pandas-stubs/_testing/__init__.pyi | 8 +- pandas-stubs/core/arrays/base.pyi | 2 +- pandas-stubs/core/arrays/categorical.pyi | 7 +- pandas-stubs/core/arrays/datetimelike.pyi | 17 ++- pandas-stubs/core/arrays/interval.pyi | 25 +++- pandas-stubs/core/arrays/string_.pyi | 2 +- pandas-stubs/core/base.pyi | 12 +- pandas-stubs/core/computation/eval.pyi | 2 +- pandas-stubs/core/dtypes/concat.pyi | 4 +- pandas-stubs/core/frame.pyi | 140 +++++++++++++-------- pandas-stubs/core/generic.pyi | 10 +- pandas-stubs/core/groupby/generic.pyi | 29 +++-- pandas-stubs/core/groupby/groupby.pyi | 24 ++-- pandas-stubs/core/indexes/base.pyi | 17 ++- pandas-stubs/core/indexes/category.pyi | 2 +- pandas-stubs/core/indexes/datetimelike.pyi | 24 +++- pandas-stubs/core/indexes/datetimes.pyi | 10 +- pandas-stubs/core/indexes/multi.pyi | 17 ++- pandas-stubs/core/indexes/period.pyi | 10 +- pandas-stubs/core/indexes/range.pyi | 2 +- pandas-stubs/core/indexes/timedeltas.pyi | 10 +- pandas-stubs/core/resample.pyi | 10 +- pandas-stubs/core/reshape/encoding.pyi | 8 +- pandas-stubs/core/reshape/melt.pyi | 6 +- pandas-stubs/core/reshape/merge.pyi | 2 +- pandas-stubs/core/series.pyi | 106 ++++++++-------- pandas-stubs/core/util/hashing.pyi | 5 +- pandas-stubs/core/window/ewm.pyi | 18 +-- pandas-stubs/io/feather_format.pyi | 2 +- pandas-stubs/io/formats/style.pyi | 14 +-- pandas-stubs/io/formats/style_render.pyi | 4 +- pandas-stubs/io/json/_normalize.pyi | 10 +- pandas-stubs/io/orc.pyi | 4 +- pandas-stubs/io/pytables.pyi | 8 +- pandas-stubs/io/spss.pyi | 2 +- pandas-stubs/plotting/_misc.pyi | 10 +- pandas-stubs/util/_tester.pyi | 2 +- 39 files changed, 361 insertions(+), 236 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/nattype.pyi b/pandas-stubs/_libs/tslibs/nattype.pyi index b52dd542e..d6b9ab9c2 100644 --- a/pandas-stubs/_libs/tslibs/nattype.pyi +++ b/pandas-stubs/_libs/tslibs/nattype.pyi @@ -74,8 +74,8 @@ class NaTType: def weekday(self) -> float: ... def isoweekday(self) -> float: ... def total_seconds(self) -> float: ... - def today(self, tz: _tzinfo | str | None = ...) -> NaTType: ... - def now(self, tz: _tzinfo | str | None = ...) -> NaTType: ... + def today(self, tz: _tzinfo | str | None = None) -> NaTType: ... + def now(self, tz: _tzinfo | str | None = None) -> NaTType: ... def to_pydatetime(self) -> NaTType: ... def date(self) -> NaTType: ... def round( diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index b986c186a..b2cb00eab 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -115,7 +115,7 @@ class Timestamp(datetime, SupportsIndex): @classmethod def utcfromtimestamp(cls, ts: float) -> Self: ... @classmethod - def today(cls, tz: _tzinfo | str | None = ...) -> Self: ... + def today(cls, tz: _tzinfo | str | None = None) -> Self: ... @classmethod def fromordinal( cls, @@ -123,7 +123,7 @@ class Timestamp(datetime, SupportsIndex): tz: _tzinfo | str | None = ..., ) -> Self: ... @classmethod - def now(cls, tz: _tzinfo | str | None = ...) -> Self: ... + def now(cls, tz: _tzinfo | str | None = None) -> Self: ... @classmethod def utcnow(cls) -> Self: ... # error: Signature of "combine" incompatible with supertype "datetime" @@ -299,8 +299,8 @@ class Timestamp(datetime, SupportsIndex): ambiguous: _Ambiguous = ..., nonexistent: TimestampNonexistent = ..., ) -> Self: ... - def day_name(self, locale: str | None = ...) -> str: ... - def month_name(self, locale: str | None = ...) -> str: ... + def day_name(self, locale: str | None = None) -> str: ... + def month_name(self, locale: str | None = None) -> str: ... @property def day_of_week(self) -> int: ... @property diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index c223c8096..8399a77ce 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -91,16 +91,16 @@ def assert_numpy_array_equal( right, strict_nan: bool = ..., check_dtype: bool | Literal["equiv"] = ..., - err_msg: str | None = ..., - check_same: Literal["copy", "same"] | None = ..., + err_msg: str | None = None, + check_same: Literal["copy", "same"] | None = None, obj: str = ..., - index_values: Index | np.ndarray | None = ..., + index_values: Index | np.ndarray | None = None, ) -> None: ... def assert_extension_array_equal( left: ExtensionArray, right: ExtensionArray, check_dtype: bool | Literal["equiv"] = ..., - index_values: Index | np.ndarray | None = ..., + index_values: Index | np.ndarray | None = None, check_exact: bool = ..., rtol: float = ..., atol: float = ..., diff --git a/pandas-stubs/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi index 6a7e2afee..5eaef35c1 100644 --- a/pandas-stubs/core/arrays/base.pyi +++ b/pandas-stubs/core/arrays/base.pyi @@ -45,7 +45,7 @@ class ExtensionArray: def argsort( self, *, ascending: bool = ..., kind: str = ..., **kwargs ) -> np.ndarray: ... - def fillna(self, value=..., method=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... def dropna(self): ... def shift(self, periods: int = ..., fill_value: object = ...) -> Self: ... def unique(self): ... diff --git a/pandas-stubs/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi index 61af02938..5b5bd349d 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -68,7 +68,10 @@ class Categorical(ExtensionArray): def as_ordered(self) -> Categorical: ... def as_unordered(self) -> Categorical: ... def set_categories( - self, new_categories, ordered: bool | None = ..., rename: bool = ... + self, + new_categories, + ordered: bool | None = ..., + rename: bool = ..., ) -> Categorical: ... def rename_categories(self, new_categories) -> Categorical: ... def reorder_categories( @@ -107,7 +110,7 @@ class Categorical(ExtensionArray): self, *, inplace: bool = ..., ascending: bool = ..., na_position: str = ... ): ... def view(self, dtype=...): ... - def fillna(self, value=..., method=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... def take( self, indexer: TakeIndexer, *, allow_fill: bool = ..., fill_value=... ) -> Categorical: ... diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index 8b1c6ac6d..a36a28424 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -35,13 +35,22 @@ class TimelikeOps: def unit(self) -> TimeUnit: ... def as_unit(self, unit: TimeUnit) -> Self: ... def round( - self, freq, ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ... + self, + freq, + ambiguous: TimeAmbiguous = ..., + nonexistent: TimeNonexistent = ..., ): ... def floor( - self, freq, ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ... + self, + freq, + ambiguous: TimeAmbiguous = ..., + nonexistent: TimeNonexistent = ..., ): ... def ceil( - self, freq, ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ... + self, + freq, + ambiguous: TimeAmbiguous = ..., + nonexistent: TimeNonexistent = ..., ): ... class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): @@ -80,7 +89,7 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def value_counts(self, dropna: bool = ...): ... def map(self, mapper): ... def isna(self): ... - def fillna(self, value=..., method=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... @property def freq(self): ... @freq.setter diff --git a/pandas-stubs/core/arrays/interval.pyi b/pandas-stubs/core/arrays/interval.pyi index 122f1cd8c..149952baf 100644 --- a/pandas-stubs/core/arrays/interval.pyi +++ b/pandas-stubs/core/arrays/interval.pyi @@ -32,13 +32,30 @@ class IntervalArray(IntervalMixin, ExtensionArray): cls, data, closed=..., dtype=..., copy: bool = ..., verify_integrity: bool = ... ): ... @classmethod - def from_breaks(cls, breaks, closed: str = ..., copy: bool = ..., dtype=...): ... + def from_breaks( + cls, + breaks, + closed: str = ..., + copy: bool = ..., + dtype=None, + ): ... @classmethod def from_arrays( - cls, left, right, closed: str = ..., copy: bool = ..., dtype=... + cls, + left, + right, + closed: str = ..., + copy: bool = ..., + dtype=..., ): ... @classmethod - def from_tuples(cls, data, closed: str = ..., copy: bool = ..., dtype=...): ... + def from_tuples( + cls, + data, + closed: str = ..., + copy: bool = ..., + dtype=None, + ): ... def __iter__(self): ... def __len__(self) -> int: ... @overload @@ -48,7 +65,7 @@ class IntervalArray(IntervalMixin, ExtensionArray): def __setitem__(self, key, value) -> None: ... def __eq__(self, other): ... def __ne__(self, other): ... - def fillna(self, value=..., method=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... @property def dtype(self): ... def astype(self, dtype, copy: bool = ...): ... diff --git a/pandas-stubs/core/arrays/string_.pyi b/pandas-stubs/core/arrays/string_.pyi index cdde9e028..4e0125adc 100644 --- a/pandas-stubs/core/arrays/string_.pyi +++ b/pandas-stubs/core/arrays/string_.pyi @@ -15,6 +15,6 @@ class StringArray(PandasArray): def __init__(self, values, copy: bool = ...) -> None: ... def __arrow_array__(self, type=...): ... def __setitem__(self, key, value) -> None: ... - def fillna(self, value=..., method=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... def astype(self, dtype, copy: bool = ...): ... def value_counts(self, dropna: bool = ...): ... diff --git a/pandas-stubs/core/base.pyi b/pandas-stubs/core/base.pyi index e49bd43c9..db4e028e9 100644 --- a/pandas-stubs/core/base.pyi +++ b/pandas-stubs/core/base.pyi @@ -69,10 +69,18 @@ class IndexOpsMixin(OpsMixin, Generic[S1]): def max(self, axis=..., skipna: bool = ..., **kwargs): ... def min(self, axis=..., skipna: bool = ..., **kwargs): ... def argmax( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> np.int64: ... def argmin( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> np.int64: ... def tolist(self) -> list[S1]: ... def to_list(self) -> list[S1]: ... diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index 9e0eef2bf..04684c178 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -23,6 +23,6 @@ def eval( global_dict: dict[str, Any] | None = ..., resolvers: list[Mapping] | None = ..., level: int = ..., - target: object | None = ..., + target: object | None = None, inplace: bool = ..., ) -> npt.NDArray | Scalar | DataFrame | Series | None: ... diff --git a/pandas-stubs/core/dtypes/concat.pyi b/pandas-stubs/core/dtypes/concat.pyi index a253220a7..d2b760072 100644 --- a/pandas-stubs/core/dtypes/concat.pyi +++ b/pandas-stubs/core/dtypes/concat.pyi @@ -9,5 +9,7 @@ from pandas import ( _CatT = TypeVar("_CatT", bound=Categorical | CategoricalIndex | Series) def union_categoricals( - to_union: list[_CatT], sort_categories: bool = ..., ignore_order: bool = ... + to_union: list[_CatT], + sort_categories: bool = ..., + ignore_order: bool = ..., ) -> Categorical: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 006a9dbd4..b789fe2a2 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -471,17 +471,23 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): ) -> None: ... @classmethod def from_records( - cls, data, index=..., exclude=..., columns=..., coerce_float=..., nrows=... + cls, + data, + index=..., + exclude=None, + columns=None, + coerce_float=..., + nrows=None, ) -> Self: ... def to_records( self, index: _bool = ..., column_dtypes: ( _str | npt.DTypeLike | Mapping[HashableT1, npt.DTypeLike] | None - ) = ..., + ) = None, index_dtypes: ( _str | npt.DTypeLike | Mapping[HashableT2, npt.DTypeLike] | None - ) = ..., + ) = None, ) -> np.recarray: ... @overload def to_stata( @@ -802,8 +808,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, other: NDFrameT, join: AlignJoin = ..., - axis: Axis | None = ..., - level: Level | None = ..., + axis: Axis | None = None, + level: Level | None = None, copy: _bool = ..., fill_value: Scalar | NAType | None = ..., ) -> tuple[Self, NDFrameT]: ... @@ -817,7 +823,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): copy: bool = ..., level: int | _str = ..., fill_value: Scalar | None = ..., - limit: int | None = ..., + limit: int | None = None, tolerance: float | None = ..., ) -> Self: ... @overload @@ -886,7 +892,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, periods: int | Sequence[int] = ..., freq: DateOffset | dt.timedelta | _str | None = ..., - axis: Axis = ..., + axis: Axis = None, fill_value: Scalar | NAType | None = ..., ) -> Self: ... @overload @@ -1094,7 +1100,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, other: DataFrame, func: Callable, - fill_value: Scalar | None = ..., + fill_value: Scalar | None = None, overwrite: _bool = ..., ) -> Self: ... def combine_first(self, other: DataFrame) -> Self: ... @@ -1311,7 +1317,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): index: _PivotTableIndexTypes = ..., columns: _PivotTableColumnsTypes = ..., aggfunc=..., - fill_value: Scalar | None = ..., + fill_value: Scalar | None = None, margins: _bool = ..., dropna: _bool = ..., margins_name: _str = ..., @@ -1339,7 +1345,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, id_vars: tuple | Sequence | np.ndarray | None = ..., value_vars: tuple | Sequence | np.ndarray | None = ..., - var_name: Scalar | None = ..., + var_name: Scalar | None = None, value_name: Scalar = ..., col_level: int | _str | None = ..., ignore_index: _bool = ..., @@ -1529,7 +1535,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): # Add spacing between apply() overloads and remaining annotations def map( - self, func: Callable, na_action: Literal["ignore"] | None = ..., **kwargs: Any + self, func: Callable, na_action: Literal["ignore"] | None = None, **kwargs: Any ) -> Self: ... def join( self, @@ -1566,7 +1572,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): numeric_only: _bool = ..., ) -> Self: ... def cov( - self, min_periods: int | None = ..., ddof: int = ..., numeric_only: _bool = ... + self, + min_periods: int | None = ..., + ddof: int = ..., + numeric_only: _bool = ..., ) -> Self: ... def corrwith( self, @@ -1586,10 +1595,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): ) -> Series: ... def nunique(self, axis: Axis = ..., dropna: bool = ...) -> Series: ... def idxmax( - self, axis: Axis = ..., skipna: _bool = ..., numeric_only: _bool = ... + self, + axis: Axis = ..., + skipna: _bool = ..., + numeric_only: _bool = ..., ) -> Series: ... def idxmin( - self, axis: Axis = ..., skipna: _bool = ..., numeric_only: _bool = ... + self, + axis: Axis = ..., + skipna: _bool = ..., + numeric_only: _bool = ..., ) -> Series: ... def mode( self, @@ -1623,7 +1638,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): copy: _bool = ..., ) -> Self: ... def to_period( - self, freq: _str | None = ..., axis: Axis = ..., copy: _bool = ... + self, + freq: _str | None = ..., + axis: Axis = ..., + copy: _bool = ..., ) -> Self: ... def isin(self, values: Iterable | Series | DataFrame | dict) -> Self: ... @property @@ -1633,17 +1651,17 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): column: _str | list[_str] | None = ..., by: _str | ListLike | None = ..., grid: _bool = ..., - xlabelsize: float | str | None = ..., - xrot: float | None = ..., - ylabelsize: float | str | None = ..., - yrot: float | None = ..., - ax: PlotAxes | None = ..., + xlabelsize: float | str | None = None, + xrot: float | None = None, + ylabelsize: float | str | None = None, + yrot: float | None = None, + ax: PlotAxes | None = None, sharex: _bool = ..., sharey: _bool = ..., figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., bins: int | list = ..., - backend: _str | None = ..., + backend: _str | None = None, **kwargs: Any, ): ... def boxplot( @@ -1657,7 +1675,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., return_type: Literal["axes", "dict", "both"] | None = ..., - backend: _str | None = ..., + backend: _str | None = None, **kwargs: Any, ): ... sparse = ... @@ -1710,7 +1728,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Self: ... @@ -1751,12 +1769,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): **kwargs: Any, ) -> Series[_bool]: ... @final - def asof(self, where, subset: _str | list[_str] | None = ...) -> Self: ... + def asof(self, where, subset: _str | list[_str] | None = None) -> Self: ... @final def asfreq( self, freq, - method: FillnaOptions | None = ..., + method: FillnaOptions | None = None, how: Literal["start", "end"] | None = ..., normalize: _bool = ..., fill_value: Scalar | None = ..., @@ -1873,16 +1891,32 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): @final def copy(self, deep: _bool = ...) -> Self: ... def cummax( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> Self: ... def cummin( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> Self: ... def cumprod( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> Self: ... def cumsum( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> Self: ... @final def describe( @@ -1896,14 +1930,14 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def divide( self, other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def droplevel(self, level: Level | list[Level], axis: Axis = ...) -> Self: ... @@ -1952,7 +1986,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): items: ListLike | None = ..., like: _str | None = ..., regex: _str | None = ..., - axis: Axis | None = ..., + axis: Axis | None = None, ) -> Self: ... @final def first(self, offset) -> Self: ... @@ -1963,7 +1997,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... # def from_dict # def from_records @@ -2094,21 +2128,21 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def mul( self, other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def multiply( self, other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def ne(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... @final @@ -2127,7 +2161,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def prod( self, @@ -2152,7 +2186,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def rank( @@ -2169,7 +2203,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def reindex_like( @@ -2177,7 +2211,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: DataFrame, method: FillnaOptions | Literal["nearest"] | None = ..., copy: _bool = ..., - limit: int | None = ..., + limit: int | None = None, tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., ) -> Self: ... # Rename axis with `mapper`, `axis`, and `inplace=True` @@ -2225,21 +2259,21 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def rmod( self, other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def rmul( self, other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @overload def rolling( @@ -2274,21 +2308,21 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def rsub( self, other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def rtruediv( self, other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def sample( @@ -2298,7 +2332,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): replace: _bool = ..., weights: _str | ListLike | None = ..., random_state: RandomState | None = ..., - axis: Axis | None = ..., + axis: Axis | None = None, ignore_index: _bool = ..., ) -> Self: ... def sem( @@ -2321,7 +2355,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): **kwargs: Any, ) -> Series: ... @final - def squeeze(self, axis: Axis | None = ...) -> DataFrame | Series | Scalar: ... + def squeeze(self, axis: Axis | None = None) -> DataFrame | Series | Scalar: ... def std( self, axis: Axis = ..., @@ -2336,14 +2370,14 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def subtract( self, other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... def sum( self, @@ -2483,7 +2517,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: num | ListLike | DataFrame, axis: Axis | None = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def truncate( @@ -2498,7 +2532,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, tz: TimeZones, axis: Axis = ..., - level: Level | None = ..., + level: Level | None = None, copy: _bool = ..., ) -> Self: ... @final @@ -2506,7 +2540,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, tz: TimeZones, axis: Axis = ..., - level: Level | None = ..., + level: Level | None = None, copy: _bool = ..., ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ..., diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 04acdb22a..c995384d3 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -165,7 +165,7 @@ class NDFrame(indexing.IndexingMixin): schema: _str | None = ..., if_exists: Literal["fail", "replace", "append"] = ..., index: _bool = ..., - index_label: IndexLabel = ..., + index_label: IndexLabel = None, chunksize: int | None = ..., dtype: DtypeArg | None = ..., method: ( @@ -422,14 +422,14 @@ class NDFrame(indexing.IndexingMixin): self, rule: Frequency | dt.timedelta, axis: Axis | _NoDefaultDoNotUse = ..., - closed: Literal["right", "left"] | None = ..., - label: Literal["right", "left"] | None = ..., + closed: Literal["right", "left"] | None = None, + label: Literal["right", "left"] | None = None, convention: ToTimestampHow = ..., - kind: Literal["period", "timestamp"] | None = ..., + kind: Literal["period", "timestamp"] | None = None, on: Level | None = ..., level: Level | None = ..., origin: TimeGrouperOrigin | TimestampConvertibleTypes = ..., - offset: TimedeltaConvertibleTypes | None = ..., + offset: TimedeltaConvertibleTypes | None = None, group_keys: _bool = ..., ) -> DatetimeIndexResampler[Self]: ... @final diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index 2e4864cd3..ef461aad9 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -177,7 +177,10 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): min_periods: int | None = ..., ) -> Series: ... def cov( - self, other: Series, min_periods: int | None = ..., ddof: int | None = ... + self, + other: Series, + min_periods: int | None = ..., + ddof: int | None = ..., ) -> Series: ... @property def is_monotonic_increasing(self) -> Series[bool]: ... @@ -188,13 +191,13 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): by: IndexLabel | None = ..., ax: PlotAxes | None = ..., grid: bool = ..., - xlabelsize: float | str | None = ..., - xrot: float | None = ..., - ylabelsize: float | str | None = ..., - yrot: float | None = ..., - figsize: tuple[float, float] | None = ..., + xlabelsize: float | str | None = None, + xrot: float | None = None, + ylabelsize: float | str | None = None, + yrot: float | None = None, + figsize: tuple[float, float] | None = None, bins: int | Sequence[int] = ..., - backend: str | None = ..., + backend: str | None = None, legend: bool = ..., **kwargs, ) -> Series: ... # Series[Axes] but this is not allowed @@ -424,17 +427,17 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): column: IndexLabel | None = ..., by: IndexLabel | None = ..., grid: bool = ..., - xlabelsize: float | str | None = ..., - xrot: float | None = ..., - ylabelsize: float | str | None = ..., - yrot: float | None = ..., - ax: PlotAxes | None = ..., + xlabelsize: float | str | None = None, + xrot: float | None = None, + ylabelsize: float | str | None = None, + yrot: float | None = None, + ax: PlotAxes | None = None, sharex: bool = ..., sharey: bool = ..., figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., bins: int | Sequence[int] = ..., - backend: str | None = ..., + backend: str | None = None, legend: bool = ..., **kwargs, ) -> Series: ... # Series[Axes] but this is not allowed diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index 5001037fb..b5b7e3ffd 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -101,8 +101,8 @@ class GroupBy(BaseGroupBy[NDFrameT]): def mean( self, numeric_only: bool = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final def median(self, numeric_only: bool = ...) -> NDFrameT: ... @@ -155,8 +155,8 @@ class GroupBy(BaseGroupBy[NDFrameT]): self, numeric_only: bool = ..., min_count: int = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final def prod(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... @@ -165,16 +165,16 @@ class GroupBy(BaseGroupBy[NDFrameT]): self, numeric_only: bool = ..., min_count: int = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final def max( self, numeric_only: bool = ..., min_count: int = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final def first(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... @@ -211,12 +211,12 @@ class GroupBy(BaseGroupBy[NDFrameT]): def rolling( self, window: int | dt.timedelta | str | BaseOffset | BaseIndexer | None = ..., - min_periods: int | None = ..., + min_periods: int | None = None, center: bool | None = ..., - win_type: str | None = ..., + win_type: str | None = None, axis: Axis = ..., on: str | Index | None = ..., - closed: IntervalClosedType | None = ..., + closed: IntervalClosedType | None = None, method: CalculationMethod = ..., *, selection: IndexLabel | None = ..., @@ -371,7 +371,7 @@ class BaseGroupBy(SelectionMixin[NDFrameT], GroupByIndexingMixin): **kwargs: Any, ) -> T: ... @final - def get_group(self, name, obj: NDFrameT | None = ...) -> NDFrameT: ... + def get_group(self, name, obj: NDFrameT | None = None) -> NDFrameT: ... @final def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]: ... @overload diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index 4f9ebd443..80466b0b9 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -288,7 +288,12 @@ class Index(IndexOpsMixin[S1]): def view(self, cls=...): ... def astype(self, dtype: DtypeArg, copy: bool = ...) -> Index: ... def take( - self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs + self, + indices, + axis: int = ..., + allow_fill: bool = ..., + fill_value=None, + **kwargs, ): ... def repeat(self, repeats, axis=...): ... def copy(self, name: Hashable = ..., deep: bool = ...) -> Self: ... @@ -354,7 +359,7 @@ class Index(IndexOpsMixin[S1]): def __nonzero__(self) -> None: ... __bool__ = ... def union( - self, other: list[HashableT] | Self, sort: bool | None = ... + self, other: list[HashableT] | Self, sort: bool | None = None ) -> Index: ... def intersection(self, other: list[S1] | Self, sort: bool | None = ...) -> Self: ... def difference(self, other: list | Self, sort: bool | None = None) -> Self: ... @@ -362,7 +367,7 @@ class Index(IndexOpsMixin[S1]): self, other: list[S1] | Self, result_name: Hashable = ..., - sort: bool | None = ..., + sort: bool | None = None, ) -> Self: ... def get_loc(self, key: Label) -> int | slice | np_ndarray_bool: ... def get_indexer( @@ -390,7 +395,7 @@ class Index(IndexOpsMixin[S1]): @property def array(self) -> ExtensionArray: ... def memory_usage(self, deep: bool = ...): ... - def where(self, cond, other=...): ... + def where(self, cond, other=None): ... def __contains__(self, key) -> bool: ... @final def __setitem__(self, key, value) -> None: ... @@ -427,9 +432,9 @@ class Index(IndexOpsMixin[S1]): def groupby(self, values) -> dict[Hashable, np.ndarray]: ... def map(self, mapper, na_action=...) -> Index: ... def isin(self, values, level=...) -> np_ndarray_bool: ... - def slice_indexer(self, start=..., end=..., step=...): ... + def slice_indexer(self, start=None, end=None, step=None): ... def get_slice_bound(self, label, side): ... - def slice_locs(self, start: SliceType = ..., end: SliceType = ..., step=...): ... + def slice_locs(self, start: SliceType = None, end: SliceType = None, step=...): ... def delete(self, loc) -> Self: ... def insert(self, loc, item) -> Self: ... def drop(self, labels, errors: _str = ...) -> Self: ... diff --git a/pandas-stubs/core/indexes/category.pyi b/pandas-stubs/core/indexes/category.pyi index 324ff9eac..aeb7beb0c 100644 --- a/pandas-stubs/core/indexes/category.pyi +++ b/pandas-stubs/core/indexes/category.pyi @@ -50,7 +50,7 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): def unique(self, level=...): ... def duplicated(self, keep: Literal["first", "last", False] = ...): ... @final - def where(self, cond, other=...): ... + def where(self, cond, other=None): ... def reindex(self, target, method=..., level=..., limit=..., tolerance=...): ... @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index 34a48317a..6e987859d 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -18,16 +18,32 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]): @property def is_all_dates(self) -> bool: ... def min( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> S1: ... def argmin( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> np.int64: ... def max( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> S1: ... def argmax( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = ..., + *args, + **kwargs, ) -> np.int64: ... def __rsub__( # type: ignore[override] self, other: DatetimeIndexOpsMixin diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index 40a7102cd..911040169 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -84,7 +84,11 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): def inferred_type(self) -> str: ... def indexer_at_time(self, time, asof: bool = ...): ... def indexer_between_time( - self, start_time, end_time, include_start: bool = ..., include_end: bool = ... + self, + start_time, + end_time, + include_start: bool = ..., + include_end: bool = ..., ): ... def to_julian_date(self) -> Index[float]: ... def isocalendar(self) -> DataFrame: ... @@ -101,9 +105,9 @@ def date_range( freq: str | timedelta | Timedelta | BaseOffset = ..., tz: TimeZones = ..., normalize: bool = ..., - name: Hashable | None = ..., + name: Hashable | None = None, inclusive: IntervalClosedType = ..., - unit: TimeUnit | None = ..., + unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @overload def bdate_range( diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index d313852df..3c1fc4978 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -133,14 +133,19 @@ class MultiIndex(Index): self, key: int ) -> tuple: ... def take( - self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs + self, + indices, + axis: int = ..., + allow_fill: bool = ..., + fill_value=None, + **kwargs, ): ... def append(self, other): ... def argsort(self, *args, **kwargs): ... def repeat(self, repeats, axis=...): ... @final - def where(self, cond, other=...) -> None: ... - def drop(self, codes, level=..., errors: str = ...) -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def where(self, cond, other=None) -> None: ... + def drop(self, codes, level=None, errors: str = ...) -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def swaplevel(self, i: int = ..., j: int = ...): ... def reorder_levels(self, order): ... def sortlevel( @@ -159,17 +164,17 @@ class MultiIndex(Index): ) -> int: ... def get_loc_level(self, key, level=..., drop_level: bool = ...): ... def get_locs(self, seq): ... - def truncate(self, before=..., after=...): ... + def truncate(self, before=None, after=None): ... def equals(self, other) -> bool: ... def equal_levels(self, other): ... @final - def union(self, other, sort=...): ... # pyrefly: ignore + def union(self, other, sort=None): ... # pyrefly: ignore @final def intersection( # pyright: ignore[reportIncompatibleMethodOverride] self, other: list | Self, sort: bool | None = ... ): ... @final - def difference(self, other, sort=...): ... + def difference(self, other, sort=None): ... def astype(self, dtype: DtypeArg, copy: bool = ...) -> Self: ... def insert(self, loc, item): ... def delete(self, loc): ... diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 8857677c3..7715213bb 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -78,7 +78,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): sort: bool = ..., ): ... @final - def difference(self, other, sort=...): ... + def difference(self, other, sort=None): ... def memory_usage(self, deep: bool = ...): ... @property def freqstr(self) -> str: ... @@ -87,11 +87,11 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): def period_range( start: ( str | datetime.datetime | datetime.date | pd.Timestamp | pd.Period | None - ) = ..., + ) = None, end: ( str | datetime.datetime | datetime.date | pd.Timestamp | pd.Period | None - ) = ..., - periods: int | None = ..., + ) = None, + periods: int | None = None, freq: str | BaseOffset | None = ..., - name: Hashable | None = ..., + name: Hashable | None = None, ) -> PeriodIndex: ... diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 580bed26d..06f0974fe 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -79,7 +79,7 @@ class RangeIndex(Index[int]): def any(self) -> bool: ... @final def union( # pyrefly: ignore - self, other: list[HashableT] | Index, sort=... + self, other: list[HashableT] | Index, sort=None ) -> Index | Index[int] | RangeIndex: ... @overload # type: ignore[override] def __getitem__( diff --git a/pandas-stubs/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi index 6d50cdbd2..a69e66c3d 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -79,12 +79,12 @@ class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties def shift(self, periods: int = ..., freq=...) -> Self: ... def timedelta_range( - start: TimedeltaConvertibleTypes = ..., - end: TimedeltaConvertibleTypes = ..., - periods: int | None = ..., + start: TimedeltaConvertibleTypes = None, + end: TimedeltaConvertibleTypes = None, + periods: int | None = None, freq: str | DateOffset | Timedelta | dt.timedelta | None = ..., - name: Hashable | None = ..., - closed: Literal["left", "right"] | None = ..., + name: Hashable | None = None, + closed: Literal["left", "right"] | None = None, *, unit: None | str = ..., ) -> TimedeltaIndex: ... diff --git a/pandas-stubs/core/resample.pyi b/pandas-stubs/core/resample.pyi index b0a914162..0e006b018 100644 --- a/pandas-stubs/core/resample.pyi +++ b/pandas-stubs/core/resample.pyi @@ -125,11 +125,17 @@ class Resampler(BaseGroupBy[NDFrameT]): def max(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... @final def first( - self, numeric_only: bool = ..., min_count: int = ..., skipna: bool = ... + self, + numeric_only: bool = ..., + min_count: int = ..., + skipna: bool = ..., ) -> NDFrameT: ... @final def last( - self, numeric_only: bool = ..., min_count: int = ..., skipna: bool = ... + self, + numeric_only: bool = ..., + min_count: int = ..., + skipna: bool = ..., ) -> NDFrameT: ... @final def median(self, numeric_only: bool = ...) -> NDFrameT: ... diff --git a/pandas-stubs/core/reshape/encoding.pyi b/pandas-stubs/core/reshape/encoding.pyi index 6d7a2d5e3..d6b3ebda7 100644 --- a/pandas-stubs/core/reshape/encoding.pyi +++ b/pandas-stubs/core/reshape/encoding.pyi @@ -14,16 +14,16 @@ from pandas._typing import ( def get_dummies( data: AnyArrayLike | DataFrame, - prefix: str | Iterable[str] | dict[HashableT1, str] | None = ..., + prefix: str | Iterable[str] | dict[HashableT1, str] | None = None, prefix_sep: str = ..., dummy_na: bool = ..., - columns: list[HashableT2] | None = ..., + columns: list[HashableT2] | None = None, sparse: bool = ..., drop_first: bool = ..., dtype: Dtype | None = ..., ) -> DataFrame: ... def from_dummies( data: DataFrame, - sep: str | None = ..., - default_category: Hashable | dict[str, Hashable] | None = ..., + sep: str | None = None, + default_category: Hashable | dict[str, Hashable] | None = None, ) -> DataFrame: ... diff --git a/pandas-stubs/core/reshape/melt.pyi b/pandas-stubs/core/reshape/melt.pyi index 2ae5ea422..481190b83 100644 --- a/pandas-stubs/core/reshape/melt.pyi +++ b/pandas-stubs/core/reshape/melt.pyi @@ -9,13 +9,15 @@ def melt( frame: DataFrame, id_vars: tuple | list | np.ndarray | None = ..., value_vars: tuple | list | np.ndarray | None = ..., - var_name: str | None = ..., + var_name: str | None = None, value_name: Hashable = ..., col_level: int | str | None = ..., ignore_index: bool = ..., ) -> DataFrame: ... def lreshape( - data: DataFrame, groups: dict[HashableT, list[HashableT]], dropna: bool = ... + data: DataFrame, + groups: dict[HashableT, list[HashableT]], + dropna: bool = ..., ) -> DataFrame: ... def wide_to_long( df: DataFrame, diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index 5eb781f6a..70e81a8e0 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -87,7 +87,7 @@ def merge_asof( left_by: Label | list[HashableT] | None = ..., right_by: Label | list[HashableT] | None = ..., suffixes: Suffixes = ..., - tolerance: int | timedelta | Timedelta | None = ..., + tolerance: int | timedelta | Timedelta | None = None, allow_exact_matches: bool = ..., direction: Literal["backward", "forward", "nearest"] = ..., ) -> DataFrame: ... diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index edde3f5d4..e7c5d40d6 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -428,14 +428,14 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[float]: ... def rdiv( self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... @property @@ -773,10 +773,18 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def duplicated(self, keep: DropKeep = ...) -> Series[_bool]: ... def idxmax( - self, axis: AxisIndex = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: AxisIndex = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> int | _str: ... def idxmin( - self, axis: AxisIndex = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: AxisIndex = ..., + skipna: _bool = ..., + *args: Any, + **kwargs: Any, ) -> int | _str: ... def round(self, decimals: int = ..., *args: Any, **kwargs: Any) -> Series[S1]: ... @overload @@ -942,7 +950,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def unstack( self, level: IndexLabel = ..., - fill_value: int | _str | dict | None = ..., + fill_value: int | _str | dict | None = None, sort: _bool = ..., ) -> DataFrame: ... @overload @@ -1035,8 +1043,8 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: DataFrame | Series, join: JoinHow = ..., - axis: Axis | None = ..., - level: Level | None = ..., + axis: Axis | None = None, + level: Level | None = None, copy: _bool = ..., fill_value: Scalar | NAType | None = ..., ) -> tuple[Series, Series]: ... @@ -1090,7 +1098,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other: Series[S1], method: FillnaOptions | Literal["nearest"] | None = ..., copy: _bool = ..., - limit: int | None = ..., + limit: int | None = None, tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., ) -> Self: ... @overload @@ -1133,7 +1141,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, periods: int | Sequence[int] = ..., freq: DateOffset | timedelta | _str | None = ..., - axis: Axis = ..., + axis: Axis = None, fill_value: Scalar | NAType | None = ..., ) -> Series: ... def info( @@ -1179,7 +1187,7 @@ class Series(IndexOpsMixin[S1], NDFrame): how: ToTimestampHow = ..., copy: _bool = ..., ) -> Series[S1]: ... - def to_period(self, freq: _str | None = ..., copy: _bool = ...) -> DataFrame: ... + def to_period(self, freq: _str | None = None, copy: _bool = ...) -> DataFrame: ... @property def str( self, @@ -1203,13 +1211,13 @@ class Series(IndexOpsMixin[S1], NDFrame): by: object | None = ..., ax: PlotAxes | None = ..., grid: _bool = ..., - xlabelsize: float | _str | None = ..., - xrot: float | None = ..., - ylabelsize: float | _str | None = ..., - yrot: float | None = ..., - figsize: tuple[float, float] | None = ..., + xlabelsize: float | _str | None = None, + xrot: float | None = None, + ylabelsize: float | _str | None = None, + yrot: float | None = None, + figsize: tuple[float, float] | None = None, bins: int | Sequence = ..., - backend: _str | None = ..., + backend: _str | None = None, legend: _bool = ..., **kwargs: Any, ) -> SubplotBase: ... @@ -1221,13 +1229,13 @@ class Series(IndexOpsMixin[S1], NDFrame): def droplevel(self, level: Level | list[Level], axis: AxisIndex = ...) -> Self: ... def pop(self, item: Hashable) -> S1: ... @final - def squeeze(self, axis: None = ...) -> Series[S1] | Scalar: ... + def squeeze(self, axis: None = None) -> Series[S1] | Scalar: ... @final def __abs__(self) -> Series[S1]: ... @final - def add_prefix(self, prefix: _str, axis: AxisIndex | None = ...) -> Series[S1]: ... + def add_prefix(self, prefix: _str, axis: AxisIndex | None = None) -> Series[S1]: ... @final - def add_suffix(self, suffix: _str, axis: AxisIndex | None = ...) -> Series[S1]: ... + def add_suffix(self, suffix: _str, axis: AxisIndex | None = None) -> Series[S1]: ... def reindex( self, index: Axes | None = ..., @@ -1235,7 +1243,7 @@ class Series(IndexOpsMixin[S1], NDFrame): copy: bool = ..., level: int | _str = ..., fill_value: Scalar | None = ..., - limit: int | None = ..., + limit: int | None = None, tolerance: float | None = ..., ) -> Series[S1]: ... def filter( @@ -1243,7 +1251,7 @@ class Series(IndexOpsMixin[S1], NDFrame): items: _ListLike | None = ..., like: _str | None = ..., regex: _str | None = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = None, ) -> Series[S1]: ... @final def head(self, n: int = ...) -> Series[S1]: ... @@ -1257,7 +1265,7 @@ class Series(IndexOpsMixin[S1], NDFrame): replace: _bool = ..., weights: _str | _ListLike | np.ndarray | None = ..., random_state: RandomState | None = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = None, ignore_index: _bool = ..., ) -> Series[S1]: ... @overload @@ -1398,7 +1406,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def asof( self, where: Scalar | Sequence[Scalar], - subset: _str | Sequence[_str] | None = ..., + subset: _str | Sequence[_str] | None = None, ) -> Scalar | Series[S1]: ... @overload def clip( # pyright: ignore[reportOverlappingOverload] @@ -1434,7 +1442,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def asfreq( self, freq, - method: FillnaOptions | None = ..., + method: FillnaOptions | None = None, how: Literal["start", "end"] | None = ..., normalize: _bool = ..., fill_value: Scalar | None = ..., @@ -1555,7 +1563,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, tz: TimeZones, axis: AxisIndex = ..., - level: Level | None = ..., + level: Level | None = None, copy: _bool = ..., ) -> Series[S1]: ... @final @@ -1563,7 +1571,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, tz: TimeZones, axis: AxisIndex = ..., - level: Level | None = ..., + level: Level | None = None, copy: _bool = ..., ambiguous: TimeAmbiguous = ..., nonexistent: _str = ..., @@ -1745,7 +1753,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: int = ..., ) -> Series[S1]: ... def all( @@ -1804,21 +1812,21 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[float]: ... def divmod( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def eq( self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... @final @@ -1842,21 +1850,21 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[int]: ... def ge( self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... def gt( self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... @final @@ -1881,14 +1889,14 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... def lt( self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... def max( @@ -1927,7 +1935,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[S1]: ... @overload @@ -1950,14 +1958,14 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[S1]: ... def ne( self, other: Scalar | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[_bool]: ... @final @@ -1966,7 +1974,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[S1]: ... def prod( @@ -1989,28 +1997,28 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def rdivmod( self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def rfloordiv( self, other, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def rmod( self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... @overload @@ -2059,21 +2067,21 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def rsub( self, other: Series[S1] | Scalar, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def rtruediv( self, other, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[S1]: ... def sem( @@ -2103,14 +2111,14 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[S1]: ... def subtract( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex | None = ..., ) -> Series[S1]: ... @overload @@ -2155,7 +2163,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series[float]: ... def var( diff --git a/pandas-stubs/core/util/hashing.pyi b/pandas-stubs/core/util/hashing.pyi index cedae1308..946840872 100644 --- a/pandas-stubs/core/util/hashing.pyi +++ b/pandas-stubs/core/util/hashing.pyi @@ -18,5 +18,8 @@ def hash_pandas_object( categorize: bool = ..., ) -> Series: ... def hash_array( - vals: ArrayLike, encoding: str = ..., hash_key: str = ..., categorize: bool = ... + vals: ArrayLike, + encoding: str = ..., + hash_key: str = ..., + categorize: bool = ..., ) -> npt.NDArray[np.uint64]: ... diff --git a/pandas-stubs/core/window/ewm.pyi b/pandas-stubs/core/window/ewm.pyi index 15e48ef28..f35eb4375 100644 --- a/pandas-stubs/core/window/ewm.pyi +++ b/pandas-stubs/core/window/ewm.pyi @@ -17,33 +17,33 @@ class ExponentialMovingWindow(BaseWindow[NDFrameT]): def online( self, engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine_kwargs: WindowingEngineKwargs = None, ) -> OnlineExponentialMovingWindow[NDFrameT]: ... def mean( self, numeric_only: bool = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... def sum( self, numeric_only: bool = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... def std(self, bias: bool = ..., numeric_only: bool = ...) -> NDFrameT: ... def var(self, bias: bool = ..., numeric_only: bool = ...) -> NDFrameT: ... def cov( self, other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., + pairwise: bool | None = None, bias: bool = ..., numeric_only: bool = ..., ) -> NDFrameT: ... def corr( self, other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., + pairwise: bool | None = None, numeric_only: bool = ..., ) -> NDFrameT: ... @@ -58,13 +58,13 @@ class OnlineExponentialMovingWindow(ExponentialMovingWindow[NDFrameT]): def corr( self, other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., + pairwise: bool | None = None, numeric_only: bool = ..., ): ... def cov( self, other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., + pairwise: bool | None = None, bias: bool = ..., numeric_only: bool = ..., ): ... diff --git a/pandas-stubs/io/feather_format.pyi b/pandas-stubs/io/feather_format.pyi index 47029882c..812668215 100644 --- a/pandas-stubs/io/feather_format.pyi +++ b/pandas-stubs/io/feather_format.pyi @@ -11,7 +11,7 @@ from pandas._typing import ( def read_feather( path: FilePath | ReadBuffer[bytes], - columns: list[HashableT] | None = ..., + columns: list[HashableT] | None = None, use_threads: bool = ..., storage_options: StorageOptions = ..., dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index cf0ec7f61..e546687c6 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -345,31 +345,31 @@ class Styler(StylerRenderer): self, color: str | None = ..., subset: Subset | None = ..., - props: str | None = ..., + props: str | None = None, ) -> Styler: ... def highlight_max( self, subset: Subset | None = ..., color: str = ..., axis: Axis | None = ..., - props: str | None = ..., + props: str | None = None, ) -> Styler: ... def highlight_min( self, subset: Subset | None = ..., color: str = ..., axis: Axis | None = ..., - props: str | None = ..., + props: str | None = None, ) -> Styler: ... def highlight_between( self, subset: Subset | None = ..., color: str = ..., axis: Axis | None = ..., - left: Scalar | list[Scalar] | None = ..., - right: Scalar | list[Scalar] | None = ..., + left: Scalar | list[Scalar] | None = None, + right: Scalar | list[Scalar] | None = None, inclusive: IntervalClosedType = ..., - props: str | None = ..., + props: str | None = None, ) -> Styler: ... def highlight_quantile( self, @@ -380,7 +380,7 @@ class Styler(StylerRenderer): q_right: float = ..., interpolation: QuantileInterpolation = ..., inclusive: IntervalClosedType = ..., - props: str | None = ..., + props: str | None = None, ) -> Styler: ... @classmethod def from_custom_template( diff --git a/pandas-stubs/io/formats/style_render.pyi b/pandas-stubs/io/formats/style_render.pyi index 54f8be9b8..57c7b4923 100644 --- a/pandas-stubs/io/formats/style_render.pyi +++ b/pandas-stubs/io/formats/style_render.pyi @@ -63,7 +63,7 @@ class StylerRenderer: na_rep: str | None = ..., precision: int | None = ..., decimal: str = ..., - thousands: str | None = ..., + thousands: str | None = None, escape: str | None = ..., hyperlinks: Literal["html", "latex"] | None = ..., ) -> Self: ... @@ -75,7 +75,7 @@ class StylerRenderer: na_rep: str | None = ..., precision: int | None = ..., decimal: str = ..., - thousands: str | None = ..., + thousands: str | None = None, escape: str | None = ..., hyperlinks: Literal["html", "latex"] | None = ..., ) -> Self: ... diff --git a/pandas-stubs/io/json/_normalize.pyi b/pandas-stubs/io/json/_normalize.pyi index 7239f03da..42ee73900 100644 --- a/pandas-stubs/io/json/_normalize.pyi +++ b/pandas-stubs/io/json/_normalize.pyi @@ -4,11 +4,11 @@ from pandas._typing import IgnoreRaise def json_normalize( data: dict | list[dict], - record_path: str | list | None = ..., - meta: str | list[str | list[str]] | None = ..., - meta_prefix: str | None = ..., - record_prefix: str | None = ..., + record_path: str | list | None = None, + meta: str | list[str | list[str]] | None = None, + meta_prefix: str | None = None, + record_prefix: str | None = None, errors: IgnoreRaise = ..., sep: str = ..., - max_level: int | None = ..., + max_level: int | None = None, ) -> DataFrame: ... diff --git a/pandas-stubs/io/orc.pyi b/pandas-stubs/io/orc.pyi index be90d86e4..c6b985020 100644 --- a/pandas-stubs/io/orc.pyi +++ b/pandas-stubs/io/orc.pyi @@ -12,10 +12,10 @@ from pandas._typing import ( def read_orc( path: FilePath | ReadBuffer[bytes], - columns: list[HashableT] | None = ..., + columns: list[HashableT] | None = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., # TODO type with the correct pyarrow types # filesystem: pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem - filesystem: Any | None = ..., + filesystem: Any | None = None, **kwargs: Any, ) -> DataFrame: ... diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index db06bac03..4dfa53d74 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -178,8 +178,8 @@ class HDFStore: complevel: int | None = ..., min_itemsize: int | dict[HashableT1, int] | None = ..., nan_rep: str | None = ..., - data_columns: Literal[True] | list[HashableT2] | None = ..., - encoding: str | None = ..., + data_columns: Literal[True] | list[HashableT2] | None = None, + encoding: str | None = None, errors: Literal[ "strict", "ignore", @@ -208,8 +208,8 @@ class HDFStore: chunksize: int | None = ..., expectedrows: int | None = ..., dropna: bool | None = ..., - data_columns: Literal[True] | list[HashableT3] | None = ..., - encoding: str | None = ..., + data_columns: Literal[True] | list[HashableT3] | None = None, + encoding: str | None = None, errors: Literal[ "strict", "ignore", diff --git a/pandas-stubs/io/spss.pyi b/pandas-stubs/io/spss.pyi index 52d4a23ec..c5e66712d 100644 --- a/pandas-stubs/io/spss.pyi +++ b/pandas-stubs/io/spss.pyi @@ -10,6 +10,6 @@ from pandas._typing import ( def read_spss( path: FilePath, usecols: list[HashableT] | None = ..., - convert_categoricals: bool = ..., + convert_categoricals: bool = True, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> DataFrame: ... diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index 6db741faf..d5f95352a 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -48,21 +48,21 @@ def radviz( class_column: Hashable, ax: Axes | None = ..., color: _Color | Sequence[_Color] | None = ..., - colormap: str | Colormap | None = ..., + colormap: str | Colormap | None = None, **kwds, ) -> Axes: ... def andrews_curves( frame: DataFrame, class_column: Hashable, - ax: Axes | None = ..., + ax: Axes | None = None, samples: int = ..., color: _Color | Sequence[_Color] | None = ..., - colormap: str | Colormap | None = ..., + colormap: str | Colormap | None = None, **kwargs, ) -> Axes: ... def bootstrap_plot( series: Series, - fig: Figure | None = ..., + fig: Figure | None = None, size: int = ..., samples: int = ..., **kwds, @@ -75,7 +75,7 @@ def parallel_coordinates( color: _Color | Sequence[_Color] | None = ..., use_columns: bool = ..., xticks: Sequence[float] | None = ..., - colormap: str | Colormap | None = ..., + colormap: str | Colormap | None = None, axvlines: bool = ..., axvlines_kwds: dict[str, Any] | None = ..., sort_labels: bool = ..., diff --git a/pandas-stubs/util/_tester.pyi b/pandas-stubs/util/_tester.pyi index a02a1c11c..dc663b216 100644 --- a/pandas-stubs/util/_tester.pyi +++ b/pandas-stubs/util/_tester.pyi @@ -1 +1 @@ -def test(extra_args: list[str] | None = ..., run_doctests: bool = ...) -> None: ... +def test(extra_args: list[str] | None = None, run_doctests: bool = ...) -> None: ... From 2e371b63360eaadcf63dc77f8ea1da5ae929576e Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Sat, 26 Jul 2025 22:32:46 -0400 Subject: [PATCH 02/17] add more defaults --- pandas-stubs/io/stata.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas-stubs/io/stata.pyi b/pandas-stubs/io/stata.pyi index 17f1e5bb9..5b5145aa9 100644 --- a/pandas-stubs/io/stata.pyi +++ b/pandas-stubs/io/stata.pyi @@ -101,7 +101,7 @@ class StataReader(StataParser, abc.Iterator): traceback: TracebackType | None, ) -> None: ... def __next__(self) -> DataFrame: ... - def get_chunk(self, size: int | None = ...) -> DataFrame: ... + def get_chunk(self, size: int | None = None) -> DataFrame: ... def read( self, nrows: int | None = ..., From 9617ee6fbca19cf70b2472f75bf388d6c9e5be23 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Sat, 26 Jul 2025 22:46:09 -0400 Subject: [PATCH 03/17] fix type errors --- pandas-stubs/core/frame.pyi | 2 +- pandas-stubs/core/indexes/timedeltas.pyi | 4 ++-- pandas-stubs/core/series.pyi | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index b789fe2a2..b3a44c67e 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -892,7 +892,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, periods: int | Sequence[int] = ..., freq: DateOffset | dt.timedelta | _str | None = ..., - axis: Axis = None, + axis: Axis | None = None, fill_value: Scalar | NAType | None = ..., ) -> Self: ... @overload diff --git a/pandas-stubs/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi index a69e66c3d..287a118e0 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -79,8 +79,8 @@ class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties def shift(self, periods: int = ..., freq=...) -> Self: ... def timedelta_range( - start: TimedeltaConvertibleTypes = None, - end: TimedeltaConvertibleTypes = None, + start: TimedeltaConvertibleTypes | None = None, + end: TimedeltaConvertibleTypes | None = None, periods: int | None = None, freq: str | DateOffset | Timedelta | dt.timedelta | None = ..., name: Hashable | None = None, diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index e7c5d40d6..9cfe9e7f8 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1141,7 +1141,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, periods: int | Sequence[int] = ..., freq: DateOffset | timedelta | _str | None = ..., - axis: Axis = None, + axis: Axis | None = None, fill_value: Scalar | NAType | None = ..., ) -> Series: ... def info( From e66384f63719ffcdf1a4980712d79529abdf8761 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Sun, 27 Jul 2025 14:20:42 -0400 Subject: [PATCH 04/17] add more defaults --- pandas-stubs/_libs/lib.pyi | 4 +- pandas-stubs/_libs/tslibs/nattype.pyi | 18 +- pandas-stubs/_libs/tslibs/period.pyi | 4 +- pandas-stubs/_libs/tslibs/timedeltas.pyi | 2 +- pandas-stubs/_libs/tslibs/timestamps.pyi | 20 +- pandas-stubs/_testing/__init__.pyi | 88 +++--- pandas-stubs/core/algorithms.pyi | 8 +- pandas-stubs/core/arrays/base.pyi | 10 +- pandas-stubs/core/arrays/boolean.pyi | 2 +- pandas-stubs/core/arrays/categorical.pyi | 14 +- pandas-stubs/core/arrays/datetimelike.pyi | 18 +- pandas-stubs/core/arrays/datetimes.pyi | 6 +- pandas-stubs/core/arrays/integer.pyi | 2 +- pandas-stubs/core/arrays/interval.pyi | 20 +- pandas-stubs/core/arrays/masked.pyi | 4 +- pandas-stubs/core/arrays/period.pyi | 4 +- pandas-stubs/core/arrays/sparse/accessor.pyi | 4 +- pandas-stubs/core/arrays/sparse/array.pyi | 8 +- pandas-stubs/core/arrays/string_.pyi | 4 +- pandas-stubs/core/arrays/timedeltas.pyi | 2 +- pandas-stubs/core/base.pyi | 10 +- pandas-stubs/core/computation/eval.pyi | 6 +- pandas-stubs/core/construction.pyi | 2 +- pandas-stubs/core/dtypes/concat.pyi | 4 +- pandas-stubs/core/frame.pyi | 306 +++++++++---------- pandas-stubs/core/generic.pyi | 44 +-- pandas-stubs/core/groupby/generic.pyi | 44 +-- pandas-stubs/core/groupby/groupby.pyi | 54 ++-- pandas-stubs/core/indexes/base.pyi | 24 +- pandas-stubs/core/indexes/category.pyi | 4 +- pandas-stubs/core/indexes/datetimelike.pyi | 8 +- pandas-stubs/core/indexes/datetimes.pyi | 12 +- pandas-stubs/core/indexes/interval.pyi | 6 +- pandas-stubs/core/indexes/multi.pyi | 30 +- pandas-stubs/core/indexes/period.pyi | 6 +- pandas-stubs/core/indexes/range.pyi | 4 +- pandas-stubs/core/indexes/timedeltas.pyi | 6 +- pandas-stubs/core/resample.pyi | 28 +- pandas-stubs/core/reshape/encoding.pyi | 8 +- pandas-stubs/core/reshape/melt.pyi | 10 +- pandas-stubs/core/reshape/merge.pyi | 12 +- pandas-stubs/core/series.pyi | 186 +++++------ pandas-stubs/core/util/hashing.pyi | 10 +- pandas-stubs/core/window/ewm.pyi | 26 +- pandas-stubs/core/window/rolling.pyi | 8 +- pandas-stubs/io/clipboards.pyi | 2 +- pandas-stubs/io/feather_format.pyi | 4 +- pandas-stubs/io/formats/format.pyi | 2 +- pandas-stubs/io/formats/style.pyi | 50 +-- pandas-stubs/io/formats/style_render.pyi | 4 +- pandas-stubs/io/json/_normalize.pyi | 4 +- pandas-stubs/io/json/_table_schema.pyi | 6 +- pandas-stubs/io/orc.pyi | 2 +- pandas-stubs/io/parquet.pyi | 4 +- pandas-stubs/io/pickle.pyi | 4 +- pandas-stubs/io/pytables.pyi | 22 +- pandas-stubs/io/spss.pyi | 2 +- pandas-stubs/io/stata.pyi | 10 +- pandas-stubs/plotting/_misc.pyi | 10 +- pandas-stubs/util/_doctools.pyi | 2 +- pandas-stubs/util/_print_versions.pyi | 2 +- pandas-stubs/util/_tester.pyi | 2 +- 62 files changed, 617 insertions(+), 615 deletions(-) diff --git a/pandas-stubs/_libs/lib.pyi b/pandas-stubs/_libs/lib.pyi index 022dea514..b7c735953 100644 --- a/pandas-stubs/_libs/lib.pyi +++ b/pandas-stubs/_libs/lib.pyi @@ -16,10 +16,10 @@ class _NoDefault(Enum): no_default: Final = _NoDefault.no_default _NoDefaultDoNotUse: TypeAlias = Literal[_NoDefault.no_default] # noqa: PYI047 -def infer_dtype(value: object, skipna: bool = ...) -> str: ... +def infer_dtype(value: object, skipna: bool = True) -> str: ... def is_iterator(obj: object) -> bool: ... def is_scalar(val: object) -> bool: ... -def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ... +def is_list_like(obj: object, allow_sets: bool = True) -> bool: ... def is_complex(val: object) -> TypeGuard[complex]: ... def is_bool(val: object) -> TypeGuard[bool | np.bool_]: ... def is_integer(val: object) -> TypeGuard[int | np.integer]: ... diff --git a/pandas-stubs/_libs/tslibs/nattype.pyi b/pandas-stubs/_libs/tslibs/nattype.pyi index d6b9ab9c2..211066a22 100644 --- a/pandas-stubs/_libs/tslibs/nattype.pyi +++ b/pandas-stubs/_libs/tslibs/nattype.pyi @@ -81,27 +81,27 @@ class NaTType: def round( self, freq: Frequency, - ambiguous: bool | Literal["raise"] | NaTType = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: bool | Literal["raise"] | NaTType = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> NaTType: ... def floor( self, freq: Frequency, - ambiguous: bool | Literal["raise"] | NaTType = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: bool | Literal["raise"] | NaTType = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> NaTType: ... def ceil( self, freq: Frequency, - ambiguous: bool | Literal["raise"] | NaTType = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: bool | Literal["raise"] | NaTType = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> NaTType: ... def tz_convert(self) -> NaTType: ... def tz_localize( self, tz: _tzinfo | str | None, - ambiguous: bool | Literal["raise"] | NaTType = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: bool | Literal["raise"] | NaTType = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> NaTType: ... def replace( self, @@ -154,4 +154,4 @@ class NaTType: __ge__: _NatComparison @property def unit(self) -> TimeUnit: ... - def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ... + def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... diff --git a/pandas-stubs/_libs/tslibs/period.pyi b/pandas-stubs/_libs/tslibs/period.pyi index cf93f3664..d13c4675c 100644 --- a/pandas-stubs/_libs/tslibs/period.pyi +++ b/pandas-stubs/_libs/tslibs/period.pyi @@ -197,12 +197,12 @@ class Period(PeriodMixin): def day_of_year(self) -> int: ... @property def day_of_week(self) -> int: ... - def asfreq(self, freq: str | BaseOffset, how: _PeriodFreqHow = ...) -> Period: ... + def asfreq(self, freq: str | BaseOffset, how: _PeriodFreqHow = "end") -> Period: ... @classmethod def now(cls, freq: str | BaseOffset = ...) -> Period: ... def strftime(self, fmt: str) -> str: ... def to_timestamp( self, freq: str | BaseOffset | None = ..., - how: _PeriodToTimestampHow = ..., + how: _PeriodToTimestampHow = "S", ) -> Timestamp: ... diff --git a/pandas-stubs/_libs/tslibs/timedeltas.pyi b/pandas-stubs/_libs/tslibs/timedeltas.pyi index 01a17e1df..8d5ce244b 100644 --- a/pandas-stubs/_libs/tslibs/timedeltas.pyi +++ b/pandas-stubs/_libs/tslibs/timedeltas.pyi @@ -388,4 +388,4 @@ class Timedelta(timedelta): def view(self, dtype: npt.DTypeLike = ...) -> object: ... @property def unit(self) -> TimeUnit: ... - def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ... + def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index b2cb00eab..26afc7744 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -157,7 +157,7 @@ class Timestamp(datetime, SupportsIndex): ) -> Timestamp: ... def astimezone(self, tz: _tzinfo | None = ...) -> Self: ... def ctime(self) -> str: ... - def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ... + def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ... @classmethod def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def utcoffset(self) -> timedelta | None: ... @@ -276,28 +276,28 @@ class Timestamp(datetime, SupportsIndex): def tz_localize( self, tz: TimeZones, - ambiguous: _Ambiguous = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: _Ambiguous = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> Self: ... def normalize(self) -> Self: ... # TODO: round/floor/ceil could return NaT? def round( self, freq: str, - ambiguous: _Ambiguous = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: _Ambiguous = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> Self: ... def floor( self, freq: str, - ambiguous: _Ambiguous = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: _Ambiguous = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> Self: ... def ceil( self, freq: str, - ambiguous: _Ambiguous = ..., - nonexistent: TimestampNonexistent = ..., + ambiguous: _Ambiguous = "raise", + nonexistent: TimestampNonexistent = "raise", ) -> Self: ... def day_name(self, locale: str | None = None) -> str: ... def month_name(self, locale: str | None = None) -> str: ... @@ -322,6 +322,6 @@ class Timestamp(datetime, SupportsIndex): def daysinmonth(self) -> int: ... @property def unit(self) -> TimeUnit: ... - def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ... + def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... # To support slicing def __index__(self) -> int: ... diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index 8399a77ce..ed761d1a9 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -36,29 +36,29 @@ from pandas._typing import ( def assert_almost_equal( left: T, right: T, - check_dtype: bool | Literal["equiv"] = ..., - rtol: float = ..., - atol: float = ..., + check_dtype: bool | Literal["equiv"] = "equiv", + rtol: float = 1e-5, + atol: float = 1e-8, **kwargs, ) -> None: ... def assert_dict_equal(left: dict, right: dict, compare_keys: bool = ...) -> None: ... def assert_index_equal( left: Index, right: Index, - exact: bool | Literal["equiv"] = ..., - check_names: bool = ..., - check_exact: bool = ..., - check_categorical: bool = ..., - check_order: bool = ..., - rtol: float = ..., - atol: float = ..., - obj: str = ..., + exact: bool | Literal["equiv"] = "equiv", + check_names: bool = True, + check_exact: bool = True, + check_categorical: bool = True, + check_order: bool = True, + rtol: float = 1e-5, + atol: float = 1e-8, + obj: str = "Index", ) -> None: ... def assert_class_equal( left: T, right: T, exact: bool | Literal["equiv"] = ..., obj: str = ... ) -> None: ... def assert_attr_equal( - attr: str, left: object, right: object, obj: str = ... + attr: str, left: object, right: object, obj: str = "Attributes" ) -> None: ... def assert_is_valid_plot_return_object( objs: Series | np.ndarray | Artist | tuple | dict, @@ -67,15 +67,15 @@ def assert_is_sorted(seq: AnyArrayLike) -> None: ... def assert_categorical_equal( left: Categorical, right: Categorical, - check_dtype: bool = ..., - check_category_order: bool = ..., - obj: str = ..., + check_dtype: bool = True, + check_category_order: bool = True, + obj: str = "Categorical", ) -> None: ... def assert_interval_array_equal( left: IntervalArray, right: IntervalArray, - exact: bool | Literal["equiv"] = ..., - obj: str = ..., + exact: bool | Literal["equiv"] = "equiv", + obj: str = "IntervalArray", ) -> None: ... def assert_period_array_equal( left: PeriodArray, right: PeriodArray, obj: str = ... @@ -89,22 +89,22 @@ def assert_timedelta_array_equal( def assert_numpy_array_equal( left, right, - strict_nan: bool = ..., - check_dtype: bool | Literal["equiv"] = ..., + strict_nan: bool = False, + check_dtype: bool | Literal["equiv"] = True, err_msg: str | None = None, check_same: Literal["copy", "same"] | None = None, - obj: str = ..., + obj: str = "numpy array", index_values: Index | np.ndarray | None = None, ) -> None: ... def assert_extension_array_equal( left: ExtensionArray, right: ExtensionArray, - check_dtype: bool | Literal["equiv"] = ..., + check_dtype: bool | Literal["equiv"] = True, index_values: Index | np.ndarray | None = None, - check_exact: bool = ..., - rtol: float = ..., - atol: float = ..., - obj: str = ..., + check_exact: bool = False, + rtol: float = 1e-5, + atol: float = 1e-8, + obj: str = "ExtensionArray", ) -> None: ... @overload def assert_series_equal( @@ -151,21 +151,21 @@ def assert_series_equal( def assert_frame_equal( left: DataFrame, right: DataFrame, - check_dtype: bool | Literal["equiv"] = ..., - check_index_type: bool | Literal["equiv"] = ..., - check_column_type: bool | Literal["equiv"] = ..., - check_frame_type: bool = ..., - check_names: bool = ..., - by_blocks: bool = ..., - check_exact: bool = ..., - check_datetimelike_compat: bool = ..., - check_categorical: bool = ..., - check_like: bool = ..., - check_freq: bool = ..., - check_flags: bool = ..., - rtol: float = ..., - atol: float = ..., - obj: str = ..., + check_dtype: bool | Literal["equiv"] = True, + check_index_type: bool | Literal["equiv"] = "equiv", + check_column_type: bool | Literal["equiv"] = "equiv", + check_frame_type: bool = True, + check_names: bool = True, + by_blocks: bool = False, + check_exact: bool = False, + check_datetimelike_compat: bool = False, + check_categorical: bool = True, + check_like: bool = False, + check_freq: bool = True, + check_flags: bool = True, + rtol: float = 1e-5, + atol: float = 1e-8, + obj: str = "DataFrame", ) -> None: ... def assert_equal(left, right, **kwargs) -> None: ... def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ... @@ -178,12 +178,12 @@ def assert_produces_warning( ) = ..., filter_level: Literal[ "error", "ignore", "always", "default", "module", "once" - ] = ..., - check_stacklevel: bool = ..., - raise_on_extra_warnings: bool = ..., + ] = "always", + check_stacklevel: bool = True, + raise_on_extra_warnings: bool = True, match: str | None = None, ) -> Generator[list[warnings.WarningMessage], None, None]: ... @contextmanager def ensure_clean( - filename: str | None = ..., return_filelike: bool = ..., **kwargs: Any + filename: str | None = ..., return_filelike: bool = False, **kwargs: Any ) -> Generator[str, None, None]: ... diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index 49f922a1c..ca8cb3c40 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -64,11 +64,11 @@ def factorize( ) -> tuple[np.ndarray, Categorical]: ... def value_counts( values: AnyArrayLike | list | tuple, - sort: bool = ..., - ascending: bool = ..., - normalize: bool = ..., + sort: bool = True, + ascending: bool = False, + normalize: bool = False, bins: int | None = ..., - dropna: bool = ..., + dropna: bool = True, ) -> Series: ... def take( arr, diff --git a/pandas-stubs/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi index 5eaef35c1..b5c0ef7cc 100644 --- a/pandas-stubs/core/arrays/base.pyi +++ b/pandas-stubs/core/arrays/base.pyi @@ -29,7 +29,7 @@ class ExtensionArray: def to_numpy( self, dtype: npt.DTypeLike | None = ..., - copy: bool = ..., + copy: bool = False, na_value: Scalar = ..., ) -> np.ndarray: ... @property @@ -40,17 +40,17 @@ class ExtensionArray: def ndim(self) -> int: ... @property def nbytes(self) -> int: ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def isna(self) -> ArrayLike: ... def argsort( self, *, ascending: bool = ..., kind: str = ..., **kwargs ) -> np.ndarray: ... def fillna(self, value=..., method=None, limit=None): ... def dropna(self): ... - def shift(self, periods: int = ..., fill_value: object = ...) -> Self: ... + def shift(self, periods: int = 1, fill_value: object = ...) -> Self: ... def unique(self): ... def searchsorted(self, value, side: str = ..., sorter=...): ... - def factorize(self, use_na_sentinel: bool = ...) -> tuple[np.ndarray, Self]: ... + def factorize(self, use_na_sentinel: bool = True) -> tuple[np.ndarray, Self]: ... def repeat(self, repeats, axis=...): ... def take( self, @@ -61,7 +61,7 @@ class ExtensionArray: ) -> Self: ... def copy(self) -> Self: ... def view(self, dtype=...) -> Self | np.ndarray: ... - def ravel(self, order=...) -> Self: ... + def ravel(self, order="C") -> Self: ... def tolist(self) -> list: ... def _reduce( self, name: str, *, skipna: bool = ..., keepdims: bool = ..., **kwargs diff --git a/pandas-stubs/core/arrays/boolean.pyi b/pandas-stubs/core/arrays/boolean.pyi index 0f9a51bc2..4eaf5b33d 100644 --- a/pandas-stubs/core/arrays/boolean.pyi +++ b/pandas-stubs/core/arrays/boolean.pyi @@ -20,6 +20,6 @@ class BooleanArray(BaseMaskedArray): def dtype(self): ... def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... def __setitem__(self, key, value) -> None: ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... 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 5b5bd349d..57f075e21 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -49,7 +49,7 @@ class Categorical(ExtensionArray): def ordered(self) -> Ordered: ... @property def dtype(self) -> CategoricalDtype: ... - def astype(self, dtype: Dtype, copy: bool = ...) -> ArrayLike: ... + def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike: ... def size(self) -> int: ... def tolist(self) -> list[Scalar]: ... to_list = ... @@ -70,8 +70,8 @@ class Categorical(ExtensionArray): def set_categories( self, new_categories, - ordered: bool | None = ..., - rename: bool = ..., + ordered: bool | None = False, + rename: bool = False, ) -> Categorical: ... def rename_categories(self, new_categories) -> Categorical: ... def reorder_categories( @@ -89,7 +89,7 @@ class Categorical(ExtensionArray): def __ge__(self, other) -> bool: ... @property def shape(self): ... - def shift(self, periods=..., fill_value=...): ... + def shift(self, periods=1, fill_value=...): ... def __array__(self, dtype=...) -> np.ndarray: ... def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... @property @@ -103,7 +103,7 @@ class Categorical(ExtensionArray): def notna(self) -> np_ndarray_bool: ... def notnull(self) -> np_ndarray_bool: ... def dropna(self): ... - def value_counts(self, dropna: bool = ...): ... + def value_counts(self, dropna: bool = True): ... def check_for_ordered(self, op) -> None: ... def argsort(self, *, ascending: bool = ..., kind: str = ..., **kwargs): ... def sort_values( @@ -155,8 +155,8 @@ class CategoricalAccessor(PandasDelegate, NoNewAttributesMixin): def set_categories( self, new_categories: ListLike, - ordered: bool | None = ..., - rename: bool = ..., + ordered: bool | None = False, + rename: bool = False, ) -> Series: ... def as_ordered(self) -> Series: ... def as_unordered(self) -> Series: ... diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index a36a28424..a93f8c54b 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -37,20 +37,20 @@ class TimelikeOps: def round( self, freq, - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... def floor( self, freq, - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... def ceil( self, freq, - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): @@ -79,14 +79,14 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def __setitem__( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, key: int | Sequence[int] | Sequence[bool] | slice, value ) -> None: ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def view(self, dtype=...): ... def unique(self): ... def copy(self): ... - def shift(self, periods: int = ..., fill_value=..., axis: int = ...): ... + def shift(self, periods: int = 1, fill_value=..., axis: int = ...): ... def searchsorted(self, value, side: str = ..., sorter=...): ... def repeat(self, repeats, *args, **kwargs): ... # pyrefly: ignore - def value_counts(self, dropna: bool = ...): ... + def value_counts(self, dropna: bool = True): ... def map(self, mapper): ... def isna(self): ... def fillna(self, value=..., method=None, limit=None): ... diff --git a/pandas-stubs/core/arrays/datetimes.pyi b/pandas-stubs/core/arrays/datetimes.pyi index 4c7c133fd..bb82f68cf 100644 --- a/pandas-stubs/core/arrays/datetimes.pyi +++ b/pandas-stubs/core/arrays/datetimes.pyi @@ -31,13 +31,13 @@ class DatetimeArray(DatetimeLikeArrayMixin, TimelikeOps, DatelikeOps): def is_normalized(self): ... def __array__(self, dtype=...) -> np.ndarray: ... def __iter__(self): ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def tz_convert(self, tz: TimeZones): ... def tz_localize( self, tz: TimeZones, - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... def to_pydatetime(self): ... def normalize(self): ... diff --git a/pandas-stubs/core/arrays/integer.pyi b/pandas-stubs/core/arrays/integer.pyi index 7e74b8384..3290daa30 100644 --- a/pandas-stubs/core/arrays/integer.pyi +++ b/pandas-stubs/core/arrays/integer.pyi @@ -19,7 +19,7 @@ class IntegerArray(BaseMaskedArray): def __init__(self, values, mask, copy: bool = ...) -> None: ... def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... def __setitem__(self, key, value) -> None: ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... class Int8Dtype(_IntegerDtype): ... class Int16Dtype(_IntegerDtype): ... diff --git a/pandas-stubs/core/arrays/interval.pyi b/pandas-stubs/core/arrays/interval.pyi index 149952baf..304cc2960 100644 --- a/pandas-stubs/core/arrays/interval.pyi +++ b/pandas-stubs/core/arrays/interval.pyi @@ -35,8 +35,8 @@ class IntervalArray(IntervalMixin, ExtensionArray): def from_breaks( cls, breaks, - closed: str = ..., - copy: bool = ..., + closed: str = "right", + copy: bool = False, dtype=None, ): ... @classmethod @@ -44,16 +44,16 @@ class IntervalArray(IntervalMixin, ExtensionArray): cls, left, right, - closed: str = ..., - copy: bool = ..., + closed: str = "right", + copy: bool = False, dtype=..., ): ... @classmethod def from_tuples( cls, data, - closed: str = ..., - copy: bool = ..., + closed: str = "right", + copy: bool = False, dtype=None, ): ... def __iter__(self): ... @@ -68,14 +68,14 @@ class IntervalArray(IntervalMixin, ExtensionArray): def fillna(self, value=..., method=None, limit=None): ... @property def dtype(self): ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def copy(self): ... def isna(self): ... @property def nbytes(self) -> int: ... @property def size(self) -> int: ... - def shift(self, periods: int = ..., fill_value: object = ...) -> IntervalArray: ... + def shift(self, periods: int = 1, fill_value: object = ...) -> IntervalArray: ... def take( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self: Self, indices: TakeIndexer, @@ -85,7 +85,7 @@ class IntervalArray(IntervalMixin, ExtensionArray): axis=..., **kwargs, ) -> Self: ... - def value_counts(self, dropna: bool = ...): ... + def value_counts(self, dropna: bool = True): ... @property def left(self) -> Index: ... @property @@ -101,7 +101,7 @@ class IntervalArray(IntervalMixin, ExtensionArray): def is_non_overlapping_monotonic(self) -> bool: ... def __array__(self, dtype=...) -> np.ndarray: ... def __arrow_array__(self, type=...): ... - def to_tuples(self, na_tuple: bool = ...): ... + def to_tuples(self, na_tuple: bool = True): ... def repeat(self, repeats, axis: Axis | None = ...): ... @overload def contains(self, other: Series) -> Series[bool]: ... diff --git a/pandas-stubs/core/arrays/masked.pyi b/pandas-stubs/core/arrays/masked.pyi index ae33bc845..20cbdcf95 100644 --- a/pandas-stubs/core/arrays/masked.pyi +++ b/pandas-stubs/core/arrays/masked.pyi @@ -28,7 +28,7 @@ class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin): def to_numpy( self, dtype: npt.DTypeLike | None = ..., - copy: bool = ..., + copy: bool = False, na_value: Scalar = ..., ) -> np.ndarray: ... __array_priority__: int = ... @@ -38,4 +38,4 @@ class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin): @property def nbytes(self) -> int: ... def copy(self): ... - def value_counts(self, dropna: bool = ...): ... + def value_counts(self, dropna: bool = True): ... diff --git a/pandas-stubs/core/arrays/period.pyi b/pandas-stubs/core/arrays/period.pyi index 2351c3d1c..ca5c79944 100644 --- a/pandas-stubs/core/arrays/period.pyi +++ b/pandas-stubs/core/arrays/period.pyi @@ -38,5 +38,5 @@ class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps): @property def end_time(self) -> Timestamp: ... def to_timestamp(self, freq: str | None = ..., how: str = ...) -> Timestamp: ... - def asfreq(self, freq: str | None = ..., how: str = ...) -> Period: ... - def astype(self, dtype, copy: bool = ...): ... + def asfreq(self, freq: str | None = ..., how: str = "E") -> Period: ... + def astype(self, dtype, copy: bool = True): ... diff --git a/pandas-stubs/core/arrays/sparse/accessor.pyi b/pandas-stubs/core/arrays/sparse/accessor.pyi index 85f1f9a57..76499cb1a 100644 --- a/pandas-stubs/core/arrays/sparse/accessor.pyi +++ b/pandas-stubs/core/arrays/sparse/accessor.pyi @@ -6,8 +6,8 @@ class BaseAccessor: class SparseAccessor(BaseAccessor, PandasDelegate): @classmethod - def from_coo(cls, A, dense_index: bool = ...) -> Series: ... - def to_coo(self, row_levels=..., column_levels=..., sort_labels: bool = ...): ... + def from_coo(cls, A, dense_index: bool = False) -> Series: ... + def to_coo(self, row_levels=..., column_levels=..., sort_labels: bool = False): ... def to_dense(self): ... class SparseFrameAccessor(BaseAccessor, PandasDelegate): diff --git a/pandas-stubs/core/arrays/sparse/array.pyi b/pandas-stubs/core/arrays/sparse/array.pyi index 16227595b..36adde9b1 100644 --- a/pandas-stubs/core/arrays/sparse/array.pyi +++ b/pandas-stubs/core/arrays/sparse/array.pyi @@ -56,9 +56,9 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin): def npoints(self) -> int: ... def isna(self): ... def fillna(self, value=..., method=..., limit=...): ... - def shift(self, periods: int = ..., fill_value=...): ... + def shift(self, periods: int = 1, fill_value=...): ... def unique(self): ... - def value_counts(self, dropna: bool = ...): ... + def value_counts(self, dropna: bool = True): ... @overload def __getitem__(self, key: ScalarIndexer) -> Any: ... @overload @@ -67,13 +67,13 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin): key: SequenceIndexer | tuple[int | ellipsis, ...], ) -> Self: ... def copy(self): ... - def astype(self, dtype=..., copy: bool = ...): ... + def astype(self, dtype=..., copy: bool = True): ... def map(self, mapper): ... def to_dense(self): ... def nonzero(self): ... def all(self, axis=..., *args, **kwargs): ... def any(self, axis: int = ..., *args, **kwargs): ... - def sum(self, axis: int = ..., *args, **kwargs): ... + def sum(self, axis: int = 0, *args, **kwargs): ... def cumsum(self, axis: int = ..., *args, **kwargs): ... def mean(self, axis: int = ..., *args, **kwargs): ... @property diff --git a/pandas-stubs/core/arrays/string_.pyi b/pandas-stubs/core/arrays/string_.pyi index 4e0125adc..25f04093d 100644 --- a/pandas-stubs/core/arrays/string_.pyi +++ b/pandas-stubs/core/arrays/string_.pyi @@ -16,5 +16,5 @@ class StringArray(PandasArray): def __arrow_array__(self, type=...): ... def __setitem__(self, key, value) -> None: ... def fillna(self, value=..., method=None, limit=None): ... - def astype(self, dtype, copy: bool = ...): ... - def value_counts(self, dropna: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... + def value_counts(self, dropna: bool = True): ... diff --git a/pandas-stubs/core/arrays/timedeltas.pyi b/pandas-stubs/core/arrays/timedeltas.pyi index 3aeae49f5..d3bba0186 100644 --- a/pandas-stubs/core/arrays/timedeltas.pyi +++ b/pandas-stubs/core/arrays/timedeltas.pyi @@ -11,7 +11,7 @@ class TimedeltaArray(DatetimeLikeArrayMixin, TimelikeOps): @property def dtype(self): ... def __init__(self, values, dtype=..., freq=..., copy: bool = ...) -> None: ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def sum( self, *, diff --git a/pandas-stubs/core/base.pyi b/pandas-stubs/core/base.pyi index db4e028e9..da7b69b74 100644 --- a/pandas-stubs/core/base.pyi +++ b/pandas-stubs/core/base.pyi @@ -60,7 +60,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1]): def to_numpy( self, dtype: npt.DTypeLike | None = ..., - copy: bool = ..., + copy: bool = False, na_value: Scalar = ..., **kwargs, ) -> np.ndarray: ... @@ -71,14 +71,14 @@ class IndexOpsMixin(OpsMixin, Generic[S1]): def argmax( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> np.int64: ... def argmin( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> np.int64: ... @@ -105,7 +105,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1]): bins=..., dropna: bool = ..., ) -> Series[float]: ... - def nunique(self, dropna: bool = ...) -> int: ... + def nunique(self, dropna: bool = True) -> int: ... @property def is_unique(self) -> bool: ... @property @@ -113,7 +113,7 @@ class IndexOpsMixin(OpsMixin, Generic[S1]): @property def is_monotonic_increasing(self) -> bool: ... def factorize( - self, sort: bool = ..., use_na_sentinel: bool = ... + self, sort: bool = False, use_na_sentinel: bool = True ) -> tuple[np.ndarray, np.ndarray | Index | Categorical]: ... def searchsorted( self, value, side: Literal["left", "right"] = ..., sorter=... diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index 04684c178..258051ab7 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -17,12 +17,12 @@ from pandas._typing import ( def eval( expr: str | BinOp, - parser: Literal["pandas", "python"] = ..., - engine: Literal["python", "numexpr"] | None = ..., + parser: Literal["pandas", "python"] = "pandas", + engine: Literal["python", "numexpr"] | None = "numexpr", local_dict: dict[str, Any] | None = ..., global_dict: dict[str, Any] | None = ..., resolvers: list[Mapping] | None = ..., level: int = ..., target: object | None = None, - inplace: bool = ..., + inplace: bool = False, ) -> npt.NDArray | Scalar | DataFrame | Series | None: ... diff --git a/pandas-stubs/core/construction.pyi b/pandas-stubs/core/construction.pyi index 673e6ea06..3f723a4b1 100644 --- a/pandas-stubs/core/construction.pyi +++ b/pandas-stubs/core/construction.pyi @@ -8,5 +8,5 @@ from pandas.core.dtypes.dtypes import ExtensionDtype def array( data: Sequence[object], dtype: str | np.dtype | ExtensionDtype | None = ..., - copy: bool = ..., + copy: bool = True, ) -> ExtensionArray: ... diff --git a/pandas-stubs/core/dtypes/concat.pyi b/pandas-stubs/core/dtypes/concat.pyi index d2b760072..98a622c8b 100644 --- a/pandas-stubs/core/dtypes/concat.pyi +++ b/pandas-stubs/core/dtypes/concat.pyi @@ -10,6 +10,6 @@ _CatT = TypeVar("_CatT", bound=Categorical | CategoricalIndex | Series) def union_categoricals( to_union: list[_CatT], - sort_categories: bool = ..., - ignore_order: bool = ..., + sort_categories: bool = False, + ignore_order: bool = False, ) -> Categorical: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index b3a44c67e..51339ff5c 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -388,7 +388,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def to_numpy( self, dtype: npt.DTypeLike | None = ..., - copy: bool = ..., + copy: bool = False, na_value: Scalar = ..., ) -> np.ndarray: ... @overload @@ -460,12 +460,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): destination_table: str, project_id: str | None = ..., chunksize: int | None = ..., - reauth: bool = ..., - if_exists: Literal["fail", "replace", "append"] = ..., - auth_local_webserver: bool = ..., + reauth: bool = False, + if_exists: Literal["fail", "replace", "append"] = "fail", + auth_local_webserver: bool = True, table_schema: list[dict[str, str]] | None = ..., location: str | None = ..., - progress_bar: bool = ..., + progress_bar: bool = True, # Google type, not available credentials: Any = ..., ) -> None: ... @@ -476,12 +476,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): index=..., exclude=None, columns=None, - coerce_float=..., + coerce_float=False, nrows=None, ) -> Self: ... def to_records( self, - index: _bool = ..., + index: _bool = True, column_dtypes: ( _str | npt.DTypeLike | Mapping[HashableT1, npt.DTypeLike] | None ) = None, @@ -708,7 +708,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): memory_usage: bool | Literal["deep"] | None = ..., show_counts: bool | None = ..., ) -> None: ... - def memory_usage(self, index: _bool = ..., deep: _bool = ...) -> Series: ... + def memory_usage(self, index: _bool = True, deep: _bool = False) -> Series: ... def transpose(self, *args: Any, copy: _bool = ...) -> Self: ... @property def T(self) -> Self: ... @@ -807,10 +807,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def align( self, other: NDFrameT, - join: AlignJoin = ..., + join: AlignJoin = "outer", axis: Axis | None = None, level: Level | None = None, - copy: _bool = ..., + copy: _bool = True, fill_value: Scalar | NAType | None = ..., ) -> tuple[Self, NDFrameT]: ... def reindex( @@ -820,7 +820,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): columns: Axes | None = ..., axis: Axis | None = ..., method: ReindexMethod | None = ..., - copy: bool = ..., + copy: bool = True, level: int | _str = ..., fill_value: Scalar | None = ..., limit: int | None = None, @@ -1000,7 +1000,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def duplicated( self, subset: Hashable | Iterable[Hashable] | None = ..., - keep: DropKeep = ..., + keep: DropKeep = "first", ) -> Series: ... @overload def sort_values( @@ -1078,22 +1078,22 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, n: int, columns: _str | list[_str], - keep: NsmallestNlargestKeep = ..., + keep: NsmallestNlargestKeep = "first", ) -> Self: ... def nsmallest( self, n: int, columns: _str | list[_str], - keep: NsmallestNlargestKeep = ..., + keep: NsmallestNlargestKeep = "first", ) -> Self: ... - def swaplevel(self, i: Level = ..., j: Level = ..., axis: Axis = ...) -> Self: ... - def reorder_levels(self, order: list, axis: Axis = ...) -> Self: ... + def swaplevel(self, i: Level = ..., j: Level = ..., axis: Axis = 0) -> Self: ... + def reorder_levels(self, order: list, axis: Axis = 0) -> Self: ... def compare( self, other: DataFrame, - align_axis: Axis = ..., - keep_shape: bool = ..., - keep_equal: bool = ..., + align_axis: Axis = 1, + keep_shape: bool = False, + keep_equal: bool = False, result_names: Suffixes = ..., ) -> Self: ... def combine( @@ -1101,16 +1101,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: DataFrame, func: Callable, fill_value: Scalar | None = None, - overwrite: _bool = ..., + overwrite: _bool = True, ) -> Self: ... def combine_first(self, other: DataFrame) -> Self: ... def update( self, other: DataFrame | Series, - join: UpdateJoin = ..., - overwrite: _bool = ..., + join: UpdateJoin = "left", + overwrite: _bool = True, filter_func: Callable | None = ..., - errors: IgnoreRaise = ..., + errors: IgnoreRaise = "ignore", ) -> None: ... @overload def groupby( # pyright: ignore reportOverlappingOverload @@ -1316,13 +1316,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): values: _PivotTableValuesTypes = ..., index: _PivotTableIndexTypes = ..., columns: _PivotTableColumnsTypes = ..., - aggfunc=..., + aggfunc="mean", fill_value: Scalar | None = None, - margins: _bool = ..., - dropna: _bool = ..., - margins_name: _str = ..., - observed: _bool = ..., - sort: _bool = ..., + margins: _bool = False, + dropna: _bool = True, + margins_name: _str = "All", + observed: _bool = False, + sort: _bool = True, ) -> Self: ... @overload def stack( @@ -1333,24 +1333,24 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, level: IndexLabel = ..., future_stack: _bool = ... ) -> Self | Series: ... def explode( - self, column: Sequence[Hashable], ignore_index: _bool = ... + self, column: Sequence[Hashable], ignore_index: _bool = False ) -> Self: ... def unstack( self, - level: IndexLabel = ..., + level: IndexLabel = -1, fill_value: Scalar | None = ..., - sort: _bool = ..., + sort: _bool = True, ) -> Self | Series: ... def melt( self, id_vars: tuple | Sequence | np.ndarray | None = ..., value_vars: tuple | Sequence | np.ndarray | None = ..., var_name: Scalar | None = None, - value_name: Scalar = ..., + value_name: Scalar = "value", col_level: int | _str | None = ..., - ignore_index: _bool = ..., + ignore_index: _bool = True, ) -> Self: ... - def diff(self, periods: int = ..., axis: Axis = ...) -> Self: ... + def diff(self, periods: int = 1, axis: Axis = 0) -> Self: ... @overload def agg( # pyright: ignore[reportOverlappingOverload] self, @@ -1382,7 +1382,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def transform( self, func: AggFuncTypeFrame, - axis: Axis = ..., + axis: Axis = 0, *args: Any, **kwargs: Any, ) -> Self: ... @@ -1541,25 +1541,25 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, other: DataFrame | Series | list[DataFrame | Series], on: _str | list[_str] | None = ..., - how: MergeHow = ..., - lsuffix: _str = ..., - rsuffix: _str = ..., - sort: _bool = ..., + how: MergeHow = "left", + lsuffix: _str = "", + rsuffix: _str = "", + sort: _bool = False, validate: JoinValidate | None = ..., ) -> Self: ... def merge( self, right: DataFrame | Series, - how: MergeHow = ..., + how: MergeHow = "inner", on: IndexLabel | AnyArrayLike | None = ..., left_on: IndexLabel | AnyArrayLike | None = ..., right_on: IndexLabel | AnyArrayLike | None = ..., - left_index: _bool = ..., - right_index: _bool = ..., - sort: _bool = ..., + left_index: _bool = False, + right_index: _bool = False, + sort: _bool = False, suffixes: Suffixes = ..., - copy: _bool = ..., - indicator: _bool | _str = ..., + copy: _bool = True, + indicator: _bool | _str = False, validate: MergeValidate | None = ..., ) -> Self: ... def round( @@ -1569,21 +1569,21 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, method: Literal["pearson", "kendall", "spearman"] = ..., min_periods: int = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, ) -> Self: ... def cov( self, min_periods: int | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + ddof: int = 1, + numeric_only: _bool = False, ) -> Self: ... def corrwith( self, other: DataFrame | Series, - axis: Axis | None = ..., - drop: _bool = ..., + axis: Axis | None = 0, + drop: _bool = False, method: Literal["pearson", "kendall", "spearman"] = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, ) -> Series: ... @overload def count( @@ -1593,24 +1593,24 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def count( self, axis: Axis = ..., level: None = ..., numeric_only: _bool = ... ) -> Series: ... - def nunique(self, axis: Axis = ..., dropna: bool = ...) -> Series: ... + def nunique(self, axis: Axis = 0, dropna: bool = True) -> Series: ... def idxmax( self, - axis: Axis = ..., - skipna: _bool = ..., - numeric_only: _bool = ..., + axis: Axis = 0, + skipna: _bool = True, + numeric_only: _bool = False, ) -> Series: ... def idxmin( self, - axis: Axis = ..., - skipna: _bool = ..., - numeric_only: _bool = ..., + axis: Axis = 0, + skipna: _bool = True, + numeric_only: _bool = False, ) -> Series: ... def mode( self, - axis: Axis = ..., - numeric_only: _bool = ..., - dropna: _bool = ..., + axis: Axis = 0, + numeric_only: _bool = False, + dropna: _bool = True, ) -> Series: ... @overload def quantile( @@ -1634,14 +1634,14 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, freq=..., how: ToTimestampHow = ..., - axis: Axis = ..., - copy: _bool = ..., + axis: Axis = 0, + copy: _bool = True, ) -> Self: ... def to_period( self, freq: _str | None = ..., - axis: Axis = ..., - copy: _bool = ..., + axis: Axis = 0, + copy: _bool = True, ) -> Self: ... def isin(self, values: Iterable | Series | DataFrame | dict) -> Self: ... @property @@ -1650,17 +1650,17 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, column: _str | list[_str] | None = ..., by: _str | ListLike | None = ..., - grid: _bool = ..., + grid: _bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, ylabelsize: float | str | None = None, yrot: float | None = None, ax: PlotAxes | None = None, sharex: _bool = ..., - sharey: _bool = ..., + sharey: _bool = False, figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., - bins: int | list = ..., + bins: int | list = 10, backend: _str | None = None, **kwargs: Any, ): ... @@ -1670,11 +1670,11 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): by: _str | ListLike | None = ..., ax: PlotAxes | None = ..., fontsize: float | _str | None = ..., - rot: float = ..., - grid: _bool = ..., + rot: float = 0, + grid: _bool = True, figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., - return_type: Literal["axes", "dict", "both"] | None = ..., + return_type: Literal["axes", "dict", "both"] | None = "axes", backend: _str | None = None, **kwargs: Any, ): ... @@ -1776,29 +1776,29 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): freq, method: FillnaOptions | None = None, how: Literal["start", "end"] | None = ..., - normalize: _bool = ..., + normalize: _bool = False, fill_value: Scalar | None = ..., ) -> Self: ... @final def astype( self, dtype: AstypeArg | Mapping[Any, Dtype] | Series, - copy: _bool = ..., - errors: IgnoreRaise = ..., + copy: _bool = True, + errors: IgnoreRaise = "raise", ) -> Self: ... @final def at_time( self, time: _str | dt.time, asof: _bool = ..., - axis: Axis | None = ..., + axis: Axis | None = 0, ) -> Self: ... @final def between_time( self, start_time: _str | dt.time, end_time: _str | dt.time, - axis: Axis | None = ..., + axis: Axis | None = 0, ) -> Self: ... @overload def bfill( @@ -1889,32 +1889,32 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): **kwargs: Any, ) -> None: ... @final - def copy(self, deep: _bool = ...) -> Self: ... + def copy(self, deep: _bool = True) -> Self: ... def cummax( self, - axis: Axis | None = ..., - skipna: _bool = ..., + axis: Axis | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cummin( self, - axis: Axis | None = ..., - skipna: _bool = ..., + axis: Axis | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cumprod( self, - axis: Axis | None = ..., - skipna: _bool = ..., + axis: Axis | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cumsum( self, - axis: Axis | None = ..., - skipna: _bool = ..., + axis: Axis | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... @@ -1940,8 +1940,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): fill_value: float | None = None, ) -> Self: ... @final - def droplevel(self, level: Level | list[Level], axis: Axis = ...) -> Self: ... - def eq(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... + def droplevel(self, level: Level | list[Level], axis: Axis = 0) -> Self: ... + def eq(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @final def equals(self, other: Series | DataFrame) -> _bool: ... @final @@ -1951,17 +1951,17 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): span: float | None = ..., halflife: float | None = ..., alpha: float | None = ..., - min_periods: int = ..., - adjust: _bool = ..., - ignore_na: _bool = ..., - axis: Axis = ..., + min_periods: int = 0, + adjust: _bool = True, + ignore_na: _bool = False, + axis: Axis = 0, ) -> ExponentialMovingWindow[Self]: ... @final def expanding( self, - min_periods: int = ..., - axis: AxisIndex = ..., - method: CalculationMethod = ..., + min_periods: int = 1, + axis: AxisIndex = 0, + method: CalculationMethod = "single", ) -> Expanding[Self]: ... @overload def ffill( @@ -2001,7 +2001,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): ) -> Self: ... # def from_dict # def from_records - def ge(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... + def ge(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @overload def get(self, key: Hashable, default: None = ...) -> Series | None: ... @overload @@ -2010,9 +2010,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def get(self, key: list[Hashable], default: None = ...) -> Self | None: ... @overload def get(self, key: list[Hashable], default: _T) -> Self | _T: ... - def gt(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... + def gt(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @final - def head(self, n: int = ...) -> Self: ... + def head(self, n: int = 5) -> Self: ... @final def infer_objects(self) -> Self: ... # def info @@ -2044,23 +2044,23 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def kurt( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def kurtosis( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... @final def last(self, offset) -> Self: ... @final def last_valid_index(self) -> Scalar: ... - def le(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... - def lt(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... + def le(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... + def lt(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @overload def mask( self, @@ -2096,31 +2096,31 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def max( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def mean( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def median( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def min( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def mod( @@ -2144,12 +2144,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): level: Level | None = ..., fill_value: float | None = None, ) -> Self: ... - def ne(self, other, axis: Axis = ..., level: Level | None = ...) -> Self: ... + def ne(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @final def pct_change( self, - periods: int = ..., - fill_method: None = ..., + periods: int = 1, + fill_method: None = "pad", freq: DateOffset | dt.timedelta | _str | None = ..., *, axis: Axis = ..., @@ -2166,19 +2166,19 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def prod( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Series: ... def product( self, axis: Axis | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Series: ... def radd( @@ -2191,12 +2191,12 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): @final def rank( self, - axis: Axis = ..., - method: Literal["average", "min", "max", "first", "dense"] = ..., - numeric_only: _bool = ..., - na_option: Literal["keep", "top", "bottom"] = ..., - ascending: _bool = ..., - pct: _bool = ..., + axis: Axis = 0, + method: Literal["average", "min", "max", "first", "dense"] = "average", + numeric_only: _bool = False, + na_option: Literal["keep", "top", "bottom"] = "keep", + ascending: _bool = True, + pct: _bool = False, ) -> Self: ... def rdiv( self, @@ -2210,7 +2210,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, other: DataFrame, method: FillnaOptions | Literal["nearest"] | None = ..., - copy: _bool = ..., + copy: _bool = True, limit: int | None = None, tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., ) -> Self: ... @@ -2329,19 +2329,19 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, n: int | None = ..., frac: float | None = ..., - replace: _bool = ..., + replace: _bool = False, weights: _str | ListLike | None = ..., random_state: RandomState | None = ..., axis: Axis | None = None, - ignore_index: _bool = ..., + ignore_index: _bool = False, ) -> Self: ... def sem( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... # Not actually positional, but used to handle removal of deprecated @@ -2349,9 +2349,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def skew( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... @final @@ -2359,10 +2359,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def std( self, axis: Axis = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def sub( @@ -2382,16 +2382,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def sum( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Series: ... @final def swapaxes(self, axis1: Axis, axis2: Axis, copy: _bool = ...) -> Self: ... @final - def tail(self, n: int = ...) -> Self: ... + def tail(self, n: int = 5) -> Self: ... @overload def to_json( self, @@ -2531,27 +2531,27 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def tz_convert( self, tz: TimeZones, - axis: Axis = ..., + axis: Axis = 0, level: Level | None = None, - copy: _bool = ..., + copy: _bool = True, ) -> Self: ... @final def tz_localize( self, tz: TimeZones, - axis: Axis = ..., + axis: Axis = 0, level: Level | None = None, - copy: _bool = ..., - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + copy: _bool = True, + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ) -> Self: ... def var( self, axis: Axis | None = ..., - skipna: _bool | None = ..., + skipna: _bool | None = True, level: None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... @overload @@ -2593,9 +2593,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def xs( self, key: Hashable, - axis: Axis = ..., + axis: Axis = 0, level: Level | None = ..., - drop_level: _bool = ..., + drop_level: _bool = True, ) -> Self | Series: ... # floordiv overload def __floordiv__( diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index c995384d3..8b7dc86e4 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -106,18 +106,18 @@ class NDFrame(indexing.IndexingMixin): def to_excel( self, excel_writer, - sheet_name: _str = ..., - na_rep: _str = ..., + sheet_name: _str = "Sheet1", + na_rep: _str = "", float_format: _str | None = ..., columns: _str | Sequence[_str] | None = ..., - header: _bool | list[_str] = ..., - index: _bool = ..., + header: _bool | list[_str] = True, + index: _bool = True, index_label: _str | Sequence[_str] | None = ..., - startrow: int = ..., - startcol: int = ..., + startrow: int = 0, + startcol: int = 0, engine: _str | None = ..., - merge_cells: ExcelWriterMergeCells = ..., - inf_rep: _str = ..., + merge_cells: ExcelWriterMergeCells = True, + inf_rep: _str = "inf", freeze_panes: tuple[int, int] | None = ..., ) -> None: ... @final @@ -163,8 +163,8 @@ class NDFrame(indexing.IndexingMixin): name: _str, con: str | sqlalchemy.engine.Connectable | sqlite3.Connection, schema: _str | None = ..., - if_exists: Literal["fail", "replace", "append"] = ..., - index: _bool = ..., + if_exists: Literal["fail", "replace", "append"] = "fail", + index: _bool = True, index_label: IndexLabel = None, chunksize: int | None = ..., dtype: DtypeArg | None = ..., @@ -181,15 +181,15 @@ class NDFrame(indexing.IndexingMixin): def to_pickle( self, path: FilePath | WriteBuffer[bytes], - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", protocol: int = ..., storage_options: StorageOptions = ..., ) -> None: ... @final def to_clipboard( self, - excel: _bool = ..., - sep: _str | None = ..., + excel: _bool = True, + sep: _str | None = "\t", *, na_rep: _str = ..., float_format: _str | Callable[[object], _str] | None = ..., @@ -410,27 +410,27 @@ class NDFrame(indexing.IndexingMixin): @final def convert_dtypes( self, - infer_objects: _bool = ..., - convert_string: _bool = ..., - convert_integer: _bool = ..., + infer_objects: _bool = True, + convert_string: _bool = True, + convert_integer: _bool = True, convert_boolean: _bool = ..., convert_floating: _bool = ..., - dtype_backend: DtypeBackend = ..., + dtype_backend: DtypeBackend = "numpy_nullable", ) -> Self: ... @final def resample( self, rule: Frequency | dt.timedelta, - axis: Axis | _NoDefaultDoNotUse = ..., + axis: Axis | _NoDefaultDoNotUse = 0, closed: Literal["right", "left"] | None = None, label: Literal["right", "left"] | None = None, - convention: ToTimestampHow = ..., + convention: ToTimestampHow = "start", kind: Literal["period", "timestamp"] | None = None, on: Level | None = ..., level: Level | None = ..., - origin: TimeGrouperOrigin | TimestampConvertibleTypes = ..., + origin: TimeGrouperOrigin | TimestampConvertibleTypes = "start_day", offset: TimedeltaConvertibleTypes | None = None, - group_keys: _bool = ..., + group_keys: _bool = False, ) -> DatetimeIndexResampler[Self]: ... @final - def take(self, indices: TakeIndexer, axis: Axis = ..., **kwargs: Any) -> Self: ... + def take(self, indices: TakeIndexer, axis: Axis = 0, **kwargs: Any) -> Self: ... diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index ef461aad9..a1946eed1 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -156,20 +156,20 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): ) -> Series[S2]: ... def skew( self, - skipna: bool = ..., - numeric_only: bool = ..., + skipna: bool = True, + numeric_only: bool = False, **kwargs, ) -> Series: ... @property def plot(self) -> GroupByPlot[Self]: ... def nlargest( - self, n: int = ..., keep: NsmallestNlargestKeep = ... + self, n: int = 5, keep: NsmallestNlargestKeep = "first" ) -> Series[S2]: ... def nsmallest( - self, n: int = ..., keep: NsmallestNlargestKeep = ... + self, n: int = 5, keep: NsmallestNlargestKeep = "first" ) -> Series[S2]: ... - def idxmin(self, skipna: bool = ...) -> Series: ... - def idxmax(self, skipna: bool = ...) -> Series: ... + def idxmin(self, skipna: bool = True) -> Series: ... + def idxmax(self, skipna: bool = True) -> Series: ... def corr( self, other: Series, @@ -180,7 +180,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): self, other: Series, min_periods: int | None = ..., - ddof: int | None = ..., + ddof: int | None = 1, ) -> Series: ... @property def is_monotonic_increasing(self) -> Series[bool]: ... @@ -190,15 +190,15 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): self, by: IndexLabel | None = ..., ax: PlotAxes | None = ..., - grid: bool = ..., + grid: bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, ylabelsize: float | str | None = None, yrot: float | None = None, figsize: tuple[float, float] | None = None, - bins: int | Sequence[int] = ..., + bins: int | Sequence[int] = 10, backend: str | None = None, - legend: bool = ..., + legend: bool = False, **kwargs, ) -> Series: ... # Series[Axes] but this is not allowed @property @@ -294,16 +294,16 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] self, key: Iterable[Hashable] ) -> DataFrameGroupBy[ByT, _TT]: ... - def nunique(self, dropna: bool = ...) -> DataFrame: ... + def nunique(self, dropna: bool = True) -> DataFrame: ... def idxmax( self, - skipna: bool = ..., - numeric_only: bool = ..., + skipna: bool = True, + numeric_only: bool = False, ) -> DataFrame: ... def idxmin( self, - skipna: bool = ..., - numeric_only: bool = ..., + skipna: bool = True, + numeric_only: bool = False, ) -> DataFrame: ... @overload def boxplot( @@ -414,31 +414,31 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): self, method: str | Callable[[np.ndarray, np.ndarray], float] = ..., min_periods: int = ..., - numeric_only: bool = ..., + numeric_only: bool = False, ) -> DataFrame: ... def cov( self, min_periods: int | None = ..., - ddof: int | None = ..., - numeric_only: bool = ..., + ddof: int | None = 1, + numeric_only: bool = False, ) -> DataFrame: ... def hist( self, column: IndexLabel | None = ..., by: IndexLabel | None = ..., - grid: bool = ..., + grid: bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, ylabelsize: float | str | None = None, yrot: float | None = None, ax: PlotAxes | None = None, sharex: bool = ..., - sharey: bool = ..., + sharey: bool = False, figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., - bins: int | Sequence[int] = ..., + bins: int | Sequence[int] = 10, backend: str | None = None, - legend: bool = ..., + legend: bool = False, **kwargs, ) -> Series: ... # Series[Axes] but this is not allowed @property diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index b5b7e3ffd..80d6effc0 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -100,12 +100,12 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def mean( self, - numeric_only: bool = ..., + numeric_only: bool = False, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final - def median(self, numeric_only: bool = ...) -> NDFrameT: ... + def median(self, numeric_only: bool = False) -> NDFrameT: ... @final @overload def std( @@ -153,33 +153,33 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def sum( self, - numeric_only: bool = ..., - min_count: int = ..., + numeric_only: bool = False, + min_count: int = 0, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final - def prod(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def prod(self, numeric_only: bool = False, min_count: int = 0) -> NDFrameT: ... @final def min( self, - numeric_only: bool = ..., - min_count: int = ..., + numeric_only: bool = False, + min_count: int = -1, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final def max( self, - numeric_only: bool = ..., - min_count: int = ..., + numeric_only: bool = False, + min_count: int = -1, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final - def first(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def first(self, numeric_only: bool = False, min_count: int = -1) -> NDFrameT: ... @final - def last(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def last(self, numeric_only: bool = False, min_count: int = -1) -> NDFrameT: ... @final def ohlc(self) -> DataFrame: ... def describe( @@ -212,12 +212,12 @@ class GroupBy(BaseGroupBy[NDFrameT]): self, window: int | dt.timedelta | str | BaseOffset | BaseIndexer | None = ..., min_periods: int | None = None, - center: bool | None = ..., + center: bool | None = False, win_type: str | None = None, - axis: Axis = ..., + axis: Axis = 0, on: str | Index | None = ..., closed: IntervalClosedType | None = None, - method: CalculationMethod = ..., + method: CalculationMethod = "single", *, selection: IndexLabel | None = ..., ) -> RollingGroupby[NDFrameT]: ... @@ -255,22 +255,22 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def quantile( self, - q: float | AnyArrayLike = ..., + q: float | AnyArrayLike = 0.5, interpolation: str = ..., - numeric_only: bool = ..., + numeric_only: bool = False, ) -> NDFrameT: ... @final - def ngroup(self, ascending: bool = ...) -> Series[int]: ... + def ngroup(self, ascending: bool = True) -> Series[int]: ... @final - def cumcount(self, ascending: bool = ...) -> Series[int]: ... + def cumcount(self, ascending: bool = True) -> Series[int]: ... @final def rank( self, - method: str = ..., - ascending: bool = ..., - na_option: str = ..., - pct: bool = ..., - axis: AxisInt | _NoDefaultDoNotUse = ..., + method: str = "average", + ascending: bool = True, + na_option: str = "keep", + pct: bool = False, + axis: AxisInt | _NoDefaultDoNotUse = 0, ) -> NDFrameT: ... @final def cumprod( @@ -297,15 +297,15 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def shift( self, - periods: int | Sequence[int] = ..., + periods: int | Sequence[int] = 1, freq: Frequency | None = ..., - axis: Axis | _NoDefaultDoNotUse = ..., + axis: Axis | _NoDefaultDoNotUse = 0, fill_value=..., suffix: str | None = ..., ) -> NDFrameT: ... @final def diff( - self, periods: int = ..., axis: AxisInt | _NoDefaultDoNotUse = ... + self, periods: int = 1, axis: AxisInt | _NoDefaultDoNotUse = 0 ) -> NDFrameT: ... @final def pct_change( @@ -325,7 +325,7 @@ class GroupBy(BaseGroupBy[NDFrameT]): self, n: int | None = ..., frac: float | None = ..., - replace: bool = ..., + replace: bool = False, weights: Sequence | Series | None = ..., random_state: RandomState | None = ..., ) -> NDFrameT: ... diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index 80466b0b9..9eac1848a 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -286,17 +286,17 @@ class Index(IndexOpsMixin[S1]): @final def ravel(self, order: _str = ...): ... def view(self, cls=...): ... - def astype(self, dtype: DtypeArg, copy: bool = ...) -> Index: ... + def astype(self, dtype: DtypeArg, copy: bool = True) -> Index: ... def take( self, indices, axis: int = ..., - allow_fill: bool = ..., + allow_fill: bool = True, fill_value=None, **kwargs, ): ... def repeat(self, repeats, axis=...): ... - def copy(self, name: Hashable = ..., deep: bool = ...) -> Self: ... + def copy(self, name: Hashable = ..., deep: bool = False) -> Self: ... @final def __copy__(self, **kwargs): ... @final @@ -306,7 +306,7 @@ class Index(IndexOpsMixin[S1]): ) -> list[_str]: ... def to_flat_index(self): ... def to_series(self, index=..., name: Hashable = ...) -> Series: ... - def to_frame(self, index: bool = ..., name=...) -> DataFrame: ... + def to_frame(self, index: bool = True, name=...) -> DataFrame: ... @property def name(self) -> Hashable | None: ... @name.setter @@ -323,7 +323,7 @@ class Index(IndexOpsMixin[S1]): @property def nlevels(self) -> int: ... def get_level_values(self, level: int | _str) -> Index: ... - def droplevel(self, level: Level | list[Level] = ...): ... + def droplevel(self, level: Level | list[Level] = 0): ... @property def is_monotonic_increasing(self) -> bool: ... @property @@ -344,10 +344,10 @@ class Index(IndexOpsMixin[S1]): def notna(self): ... notnull = ... def fillna(self, value=...): ... - def dropna(self, how: AnyAll = ...) -> Self: ... + def dropna(self, how: AnyAll = "any") -> Self: ... def unique(self, level=...) -> Self: ... def drop_duplicates(self, *, keep: DropKeep = ...) -> Self: ... - def duplicated(self, keep: DropKeep = ...) -> np_ndarray_bool: ... + def duplicated(self, keep: DropKeep = "first") -> np_ndarray_bool: ... def __and__(self, other: Never) -> Never: ... def __rand__(self, other: Never) -> Never: ... def __or__(self, other: Never) -> Never: ... @@ -361,7 +361,9 @@ class Index(IndexOpsMixin[S1]): def union( self, other: list[HashableT] | Self, sort: bool | None = None ) -> Index: ... - def intersection(self, other: list[S1] | Self, sort: bool | None = ...) -> Self: ... + def intersection( + self, other: list[S1] | Self, sort: bool | None = False + ) -> Self: ... def difference(self, other: list | Self, sort: bool | None = None) -> Self: ... def symmetric_difference( self, @@ -394,7 +396,7 @@ class Index(IndexOpsMixin[S1]): def values(self) -> np.ndarray: ... @property def array(self) -> ExtensionArray: ... - def memory_usage(self, deep: bool = ...): ... + def memory_usage(self, deep: bool = False): ... def where(self, cond, other=None): ... def __contains__(self, key) -> bool: ... @final @@ -437,7 +439,7 @@ class Index(IndexOpsMixin[S1]): def slice_locs(self, start: SliceType = None, end: SliceType = None, step=...): ... def delete(self, loc) -> Self: ... def insert(self, loc, item) -> Self: ... - def drop(self, labels, errors: _str = ...) -> Self: ... + def drop(self, labels, errors: _str = "raise") -> Self: ... @property def shape(self) -> tuple[int, ...]: ... # Extra methods from old stubs @@ -495,6 +497,6 @@ class Index(IndexOpsMixin[S1]): | Sequence[float] ), ) -> Self: ... - def infer_objects(self, copy: bool = ...) -> Self: ... + def infer_objects(self, copy: bool = True) -> Self: ... UnknownIndex: TypeAlias = Index[Any] diff --git a/pandas-stubs/core/indexes/category.pyi b/pandas-stubs/core/indexes/category.pyi index aeb7beb0c..fa05ad240 100644 --- a/pandas-stubs/core/indexes/category.pyi +++ b/pandas-stubs/core/indexes/category.pyi @@ -39,7 +39,7 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): def __array__( self, dtype: DtypeArg = ..., copy: bool | None = ... ) -> np.ndarray: ... - def astype(self, dtype: DtypeArg, copy: bool = ...) -> Index: ... + def astype(self, dtype: DtypeArg, copy: bool = True) -> Index: ... def fillna(self, value=...): ... @property def is_unique(self) -> bool: ... @@ -48,7 +48,7 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): @property def is_monotonic_decreasing(self) -> bool: ... def unique(self, level=...): ... - def duplicated(self, keep: Literal["first", "last", False] = ...): ... + def duplicated(self, keep: Literal["first", "last", False] = "first"): ... @final def where(self, cond, other=None): ... def reindex(self, target, method=..., level=..., limit=..., tolerance=...): ... diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index 6e987859d..41e7df85a 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -20,28 +20,28 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]): def min( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> S1: ... def argmin( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> np.int64: ... def max( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> S1: ... def argmax( self, axis: AxisIndex | None = ..., - skipna: bool = ..., + skipna: bool = True, *args, **kwargs, ) -> np.int64: ... diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index 911040169..5fb525805 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -87,8 +87,8 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): self, start_time, end_time, - include_start: bool = ..., - include_end: bool = ..., + include_start: bool = True, + include_end: bool = True, ): ... def to_julian_date(self) -> Index[float]: ... def isocalendar(self) -> DataFrame: ... @@ -96,17 +96,17 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): def tzinfo(self) -> _tzinfo | None: ... @property def dtype(self) -> np.dtype | DatetimeTZDtype: ... - def shift(self, periods: int = ..., freq=...) -> Self: ... + def shift(self, periods: int = 1, freq=...) -> Self: ... def date_range( start: str | DateAndDatetimeLike | None = ..., end: str | DateAndDatetimeLike | None = ..., periods: int | None = ..., - freq: str | timedelta | Timedelta | BaseOffset = ..., + freq: str | timedelta | Timedelta | BaseOffset = "D", tz: TimeZones = ..., - normalize: bool = ..., + normalize: bool = False, name: Hashable | None = None, - inclusive: IntervalClosedType = ..., + inclusive: IntervalClosedType = "both", unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @overload diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index 026c4f2af..f6e63deb3 100644 --- a/pandas-stubs/core/indexes/interval.pyi +++ b/pandas-stubs/core/indexes/interval.pyi @@ -210,15 +210,15 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin): copy: bool = ..., dtype: IntervalDtype | None = ..., ) -> IntervalIndex[pd.Interval[pd.Timedelta]]: ... - def to_tuples(self, na_tuple: bool = ...) -> pd.Index: ... + def to_tuples(self, na_tuple: bool = True) -> pd.Index: ... @overload def __contains__(self, key: IntervalT) -> bool: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @overload def __contains__(self, key: object) -> Literal[False]: ... - def astype(self, dtype: DtypeArg, copy: bool = ...) -> IntervalIndex: ... + def astype(self, dtype: DtypeArg, copy: bool = True) -> IntervalIndex: ... @property def inferred_type(self) -> str: ... - def memory_usage(self, deep: bool = ...) -> int: ... + def memory_usage(self, deep: bool = False) -> int: ... @property def is_overlapping(self) -> bool: ... # Note: tolerance no effect. It is included in all get_loc so diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index 3c1fc4978..f711f0ba9 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -77,7 +77,7 @@ class MultiIndex(Index): def codes(self): ... def set_codes(self, codes, *, level=..., verify_integrity: bool = ...): ... def copy( # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore - self, names=..., deep: bool = ... + self, names=..., deep: bool = False ) -> Self: ... def __array__(self, dtype=...) -> np.ndarray: ... def view(self, cls=...): ... @@ -86,7 +86,7 @@ class MultiIndex(Index): def dtype(self) -> np.dtype: ... @property def dtypes(self) -> pd.Series[Dtype]: ... - def memory_usage(self, deep: bool = ...) -> int: ... + def memory_usage(self, deep: bool = False) -> int: ... @property def nbytes(self) -> int: ... def format( @@ -106,15 +106,15 @@ class MultiIndex(Index): def is_monotonic_increasing(self) -> bool: ... @property def is_monotonic_decreasing(self) -> bool: ... - def duplicated(self, keep: DropKeep = ...): ... - def dropna(self, how: AnyAll = ...) -> Self: ... + def duplicated(self, keep: DropKeep = "first"): ... + def dropna(self, how: AnyAll = "any") -> Self: ... def get_level_values(self, level: str | int) -> Index: ... def unique(self, level=...): ... def to_frame( # pyrefly: ignore self, - index: bool = ..., + index: bool = True, name: list[HashableT] = ..., - allow_duplicates: bool = ..., + allow_duplicates: bool = False, ) -> pd.DataFrame: ... def to_flat_index(self): ... def remove_unused_levels(self): ... @@ -136,7 +136,7 @@ class MultiIndex(Index): self, indices, axis: int = ..., - allow_fill: bool = ..., + allow_fill: bool = True, fill_value=None, **kwargs, ): ... @@ -145,15 +145,15 @@ class MultiIndex(Index): def repeat(self, repeats, axis=...): ... @final def where(self, cond, other=None) -> None: ... - def drop(self, codes, level=None, errors: str = ...) -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] - def swaplevel(self, i: int = ..., j: int = ...): ... + def drop(self, codes, level=None, errors: str = "raise") -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def swaplevel(self, i: int = -2, j: int = -1): ... def reorder_levels(self, order): ... def sortlevel( self, - level: Level | Sequence[Level] = ..., - ascending: bool = ..., + level: Level | Sequence[Level] = 0, + ascending: bool = True, sort_remaining: bool = ..., - na_position: NaPosition = ..., + na_position: NaPosition = "first", ): ... @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... @@ -162,7 +162,7 @@ class MultiIndex(Index): def get_slice_bound( self, label: Hashable | Sequence[Hashable], side: str ) -> int: ... - def get_loc_level(self, key, level=..., drop_level: bool = ...): ... + def get_loc_level(self, key, level=..., drop_level: bool = True): ... def get_locs(self, seq): ... def truncate(self, before=None, after=None): ... def equals(self, other) -> bool: ... @@ -171,11 +171,11 @@ class MultiIndex(Index): def union(self, other, sort=None): ... # pyrefly: ignore @final def intersection( # pyright: ignore[reportIncompatibleMethodOverride] - self, other: list | Self, sort: bool | None = ... + self, other: list | Self, sort: bool | None = False ): ... @final def difference(self, other, sort=None): ... - def astype(self, dtype: DtypeArg, copy: bool = ...) -> Self: ... + def astype(self, dtype: DtypeArg, copy: bool = True) -> Self: ... def insert(self, loc, item): ... def delete(self, loc): ... def isin(self, values, level=...) -> np_ndarray_bool: ... diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 7715213bb..015f52f6c 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -57,7 +57,7 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): @final def __array_wrap__(self, result, context=...): ... def asof_locs(self, where, mask): ... - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @property def is_full(self) -> bool: ... @@ -79,10 +79,10 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): ): ... @final def difference(self, other, sort=None): ... - def memory_usage(self, deep: bool = ...): ... + def memory_usage(self, deep: bool = False): ... @property def freqstr(self) -> str: ... - def shift(self, periods: int = ..., freq=...) -> Self: ... + def shift(self, periods: int = 1, freq=...) -> Self: ... def period_range( start: ( diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 06f0974fe..59fceab2a 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -53,12 +53,12 @@ class RangeIndex(Index[int]): @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... def tolist(self): ... - def copy(self, name: Hashable = ..., deep: bool = ..., dtype=..., **kwargs): ... + def copy(self, name: Hashable = ..., deep: bool = False, dtype=..., **kwargs): ... def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ... def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ... def argsort(self, *args, **kwargs): ... def factorize( - self, sort: bool = ..., use_na_sentinel: bool = ... + self, sort: bool = False, use_na_sentinel: bool = True ) -> tuple[npt.NDArray[np.intp], RangeIndex]: ... def equals(self, other): ... @final diff --git a/pandas-stubs/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi index 287a118e0..3feea4562 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -70,19 +70,19 @@ class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties self, other: dt.timedelta | Sequence[dt.timedelta] ) -> Index[int]: ... def __rfloordiv__(self, other: dt.timedelta | Sequence[dt.timedelta]) -> Index[int]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] - def astype(self, dtype, copy: bool = ...): ... + def astype(self, dtype, copy: bool = True): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @property def inferred_type(self) -> str: ... @final def to_series(self, index=..., name: Hashable = ...) -> TimedeltaSeries: ... - def shift(self, periods: int = ..., freq=...) -> Self: ... + def shift(self, periods: int = 1, freq=...) -> Self: ... def timedelta_range( start: TimedeltaConvertibleTypes | None = None, end: TimedeltaConvertibleTypes | None = None, periods: int | None = None, - freq: str | DateOffset | Timedelta | dt.timedelta | None = ..., + freq: str | DateOffset | Timedelta | dt.timedelta | None = "D", name: Hashable | None = None, closed: Literal["left", "right"] | None = None, *, diff --git a/pandas-stubs/core/resample.pyi b/pandas-stubs/core/resample.pyi index 0e006b018..ac315c489 100644 --- a/pandas-stubs/core/resample.pyi +++ b/pandas-stubs/core/resample.pyi @@ -116,9 +116,9 @@ class Resampler(BaseGroupBy[NDFrameT]): @final def asfreq(self, fill_value: Scalar | None = ...) -> NDFrameT: ... @final - def sum(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def sum(self, numeric_only: bool = False, min_count: int = 0) -> NDFrameT: ... @final - def prod(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def prod(self, numeric_only: bool = False, min_count: int = 0) -> NDFrameT: ... @final def min(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... @final @@ -126,27 +126,27 @@ class Resampler(BaseGroupBy[NDFrameT]): @final def first( self, - numeric_only: bool = ..., - min_count: int = ..., - skipna: bool = ..., + numeric_only: bool = False, + min_count: int = -1, + skipna: bool = True, ) -> NDFrameT: ... @final def last( self, - numeric_only: bool = ..., - min_count: int = ..., - skipna: bool = ..., + numeric_only: bool = False, + min_count: int = -1, + skipna: bool = True, ) -> NDFrameT: ... @final - def median(self, numeric_only: bool = ...) -> NDFrameT: ... + def median(self, numeric_only: bool = False) -> NDFrameT: ... @final - def mean(self, numeric_only: bool = ...) -> NDFrameT: ... + def mean(self, numeric_only: bool = False) -> NDFrameT: ... @final - def std(self, ddof: int = ..., numeric_only: bool = ...) -> NDFrameT: ... + def std(self, ddof: int = 1, numeric_only: bool = False) -> NDFrameT: ... @final - def var(self, ddof: int = ..., numeric_only: bool = ...) -> NDFrameT: ... + def var(self, ddof: int = 1, numeric_only: bool = False) -> NDFrameT: ... @final - def sem(self, ddof: int = ..., numeric_only: bool = ...) -> NDFrameT: ... + def sem(self, ddof: int = 1, numeric_only: bool = False) -> NDFrameT: ... @final def ohlc(self) -> DataFrame: ... @overload @@ -162,7 +162,7 @@ class Resampler(BaseGroupBy[NDFrameT]): @final def quantile( self, - q: float | list[float] | npt.NDArray[np.double] | Series[float] = ..., + q: float | list[float] | npt.NDArray[np.double] | Series[float] = 0.5, **kwargs, ) -> NDFrameT: ... diff --git a/pandas-stubs/core/reshape/encoding.pyi b/pandas-stubs/core/reshape/encoding.pyi index d6b3ebda7..b5cd6e6d8 100644 --- a/pandas-stubs/core/reshape/encoding.pyi +++ b/pandas-stubs/core/reshape/encoding.pyi @@ -15,11 +15,11 @@ from pandas._typing import ( def get_dummies( data: AnyArrayLike | DataFrame, prefix: str | Iterable[str] | dict[HashableT1, str] | None = None, - prefix_sep: str = ..., - dummy_na: bool = ..., + prefix_sep: str = "_", + dummy_na: bool = False, columns: list[HashableT2] | None = None, - sparse: bool = ..., - drop_first: bool = ..., + sparse: bool = False, + drop_first: bool = False, dtype: Dtype | None = ..., ) -> DataFrame: ... def from_dummies( diff --git a/pandas-stubs/core/reshape/melt.pyi b/pandas-stubs/core/reshape/melt.pyi index 481190b83..f83b289ae 100644 --- a/pandas-stubs/core/reshape/melt.pyi +++ b/pandas-stubs/core/reshape/melt.pyi @@ -10,20 +10,20 @@ def melt( id_vars: tuple | list | np.ndarray | None = ..., value_vars: tuple | list | np.ndarray | None = ..., var_name: str | None = None, - value_name: Hashable = ..., + value_name: Hashable = "value", col_level: int | str | None = ..., - ignore_index: bool = ..., + ignore_index: bool = True, ) -> DataFrame: ... def lreshape( data: DataFrame, groups: dict[HashableT, list[HashableT]], - dropna: bool = ..., + dropna: bool = True, ) -> DataFrame: ... def wide_to_long( df: DataFrame, stubnames: str | list[str], i: str | list[str], j: str, - sep: str = ..., - suffix: str = ..., + sep: str = "", + suffix: str = "\\d+", ) -> DataFrame: ... diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index 70e81a8e0..b0c2af537 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -23,15 +23,15 @@ from pandas._typing import ( def merge( left: DataFrame | Series, right: DataFrame | Series, - how: MergeHow = ..., + how: MergeHow = "inner", on: Label | list[HashableT] | AnyArrayLike | None = ..., left_on: Label | list[HashableT] | AnyArrayLike | None = ..., right_on: Label | list[HashableT] | AnyArrayLike | None = ..., - left_index: bool = ..., - right_index: bool = ..., - sort: bool = ..., + left_index: bool = False, + right_index: bool = False, + sort: bool = False, suffixes: Suffixes = ..., - indicator: bool | str = ..., + indicator: bool | str = False, validate: ValidationOptions = ..., ) -> DataFrame: ... @overload @@ -88,6 +88,6 @@ def merge_asof( right_by: Label | list[HashableT] | None = ..., suffixes: Suffixes = ..., tolerance: int | timedelta | Timedelta | None = None, - allow_exact_matches: bool = ..., + allow_exact_matches: bool = True, direction: Literal["backward", "forward", "nearest"] = ..., ) -> DataFrame: ... diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 9cfe9e7f8..22bcf6e0a 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -753,7 +753,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def count(self, level: None = ...) -> int: ... # type: ignore[overload-overlap] @overload def count(self, level: Hashable) -> Series[S1]: ... - def mode(self, dropna=...) -> Series[S1]: ... + def mode(self, dropna=True) -> Series[S1]: ... def unique(self) -> np.ndarray: ... @overload def drop_duplicates( @@ -771,22 +771,22 @@ class Series(IndexOpsMixin[S1], NDFrame): inplace: Literal[False] = ..., ignore_index: _bool = ..., ) -> Series[S1]: ... - def duplicated(self, keep: DropKeep = ...) -> Series[_bool]: ... + def duplicated(self, keep: DropKeep = "first") -> Series[_bool]: ... def idxmax( self, axis: AxisIndex = ..., - skipna: _bool = ..., + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> int | _str: ... def idxmin( self, axis: AxisIndex = ..., - skipna: _bool = ..., + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> int | _str: ... - def round(self, decimals: int = ..., *args: Any, **kwargs: Any) -> Series[S1]: ... + def round(self, decimals: int = 0, *args: Any, **kwargs: Any) -> Series[S1]: ... @overload def quantile( self, @@ -806,7 +806,7 @@ class Series(IndexOpsMixin[S1], NDFrame): min_periods: int = ..., ) -> float: ... def cov( - self, other: Series[S1], min_periods: int | None = ..., ddof: int = ... + self, other: Series[S1], min_periods: int | None = ..., ddof: int = 1 ) -> float: ... @overload def diff(self: Series[_bool], periods: int = ...) -> Series[type[object]]: ... # type: ignore[overload-overlap] @@ -820,7 +820,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def diff(self: Series[_str], periods: int = ...) -> Never: ... @overload def diff(self, periods: int = ...) -> Series[float]: ... - def autocorr(self, lag: int = ...) -> float: ... + def autocorr(self, lag: int = 1) -> float: ... @overload def dot(self, other: Series[S1]) -> Scalar: ... @overload @@ -933,17 +933,17 @@ class Series(IndexOpsMixin[S1], NDFrame): def argsort( self, axis: AxisIndex = ..., - kind: SortKind = ..., + kind: SortKind = "quicksort", order: None = ..., ) -> Series[int]: ... def nlargest( - self, n: int = ..., keep: NsmallestNlargestKeep = ... + self, n: int = 5, keep: NsmallestNlargestKeep = "first" ) -> Series[S1]: ... def nsmallest( - self, n: int = ..., keep: NsmallestNlargestKeep = ... + self, n: int = 5, keep: NsmallestNlargestKeep = "first" ) -> Series[S1]: ... def swaplevel( - self, i: Level = ..., j: Level = ..., copy: _bool = ... + self, i: Level = ..., j: Level = ..., copy: _bool = True ) -> Series[S1]: ... def reorder_levels(self, order: list) -> Series[S1]: ... def explode(self) -> Series[S1]: ... @@ -951,7 +951,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, level: IndexLabel = ..., fill_value: int | _str | dict | None = None, - sort: _bool = ..., + sort: _bool = True, ) -> DataFrame: ... @overload def map( @@ -1042,10 +1042,10 @@ class Series(IndexOpsMixin[S1], NDFrame): def align( self, other: DataFrame | Series, - join: JoinHow = ..., + join: JoinHow = "outer", axis: Axis | None = None, level: Level | None = None, - copy: _bool = ..., + copy: _bool = True, fill_value: Scalar | NAType | None = ..., ) -> tuple[Series, Series]: ... @overload @@ -1097,7 +1097,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: Series[S1], method: FillnaOptions | Literal["nearest"] | None = ..., - copy: _bool = ..., + copy: _bool = True, limit: int | None = None, tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., ) -> Self: ... @@ -1151,7 +1151,7 @@ class Series(IndexOpsMixin[S1], NDFrame): memory_usage: bool | Literal["deep"] | None = ..., show_counts: bool | None = ..., ) -> None: ... - def memory_usage(self, index: _bool = ..., deep: _bool = ...) -> int: ... + def memory_usage(self, index: _bool = True, deep: _bool = False) -> int: ... def isin(self, values: Iterable | Series[S1] | dict) -> Series[_bool]: ... def between( self, @@ -1185,9 +1185,9 @@ class Series(IndexOpsMixin[S1], NDFrame): self, freq=..., how: ToTimestampHow = ..., - copy: _bool = ..., + copy: _bool = True, ) -> Series[S1]: ... - def to_period(self, freq: _str | None = None, copy: _bool = ...) -> DataFrame: ... + def to_period(self, freq: _str | None = None, copy: _bool = True) -> DataFrame: ... @property def str( self, @@ -1210,15 +1210,15 @@ class Series(IndexOpsMixin[S1], NDFrame): self, by: object | None = ..., ax: PlotAxes | None = ..., - grid: _bool = ..., + grid: _bool = True, xlabelsize: float | _str | None = None, xrot: float | None = None, ylabelsize: float | _str | None = None, yrot: float | None = None, figsize: tuple[float, float] | None = None, - bins: int | Sequence = ..., + bins: int | Sequence = 10, backend: _str | None = None, - legend: _bool = ..., + legend: _bool = False, **kwargs: Any, ) -> SubplotBase: ... @final @@ -1226,7 +1226,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis1: AxisIndex, axis2: AxisIndex, copy: _bool = ... ) -> Series[S1]: ... @final - def droplevel(self, level: Level | list[Level], axis: AxisIndex = ...) -> Self: ... + def droplevel(self, level: Level | list[Level], axis: AxisIndex = 0) -> Self: ... def pop(self, item: Hashable) -> S1: ... @final def squeeze(self, axis: None = None) -> Series[S1] | Scalar: ... @@ -1240,7 +1240,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, index: Axes | None = ..., method: ReindexMethod | None = ..., - copy: bool = ..., + copy: bool = True, level: int | _str = ..., fill_value: Scalar | None = ..., limit: int | None = None, @@ -1254,19 +1254,19 @@ class Series(IndexOpsMixin[S1], NDFrame): axis: AxisIndex | None = None, ) -> Series[S1]: ... @final - def head(self, n: int = ...) -> Series[S1]: ... + def head(self, n: int = 5) -> Series[S1]: ... @final - def tail(self, n: int = ...) -> Series[S1]: ... + def tail(self, n: int = 5) -> Series[S1]: ... @final def sample( self, n: int | None = ..., frac: float | None = ..., - replace: _bool = ..., + replace: _bool = False, weights: _str | _ListLike | np.ndarray | None = ..., random_state: RandomState | None = ..., axis: AxisIndex | None = None, - ignore_index: _bool = ..., + ignore_index: _bool = False, ) -> Series[S1]: ... @overload def astype( @@ -1339,9 +1339,9 @@ class Series(IndexOpsMixin[S1], NDFrame): errors: IgnoreRaise = ..., ) -> Series: ... @final - def copy(self, deep: _bool = ...) -> Series[S1]: ... + def copy(self, deep: _bool = True) -> Series[S1]: ... @final - def infer_objects(self, copy: _bool = ...) -> Series[S1]: ... + def infer_objects(self, copy: _bool = True) -> Series[S1]: ... @overload def ffill( self, @@ -1444,7 +1444,7 @@ class Series(IndexOpsMixin[S1], NDFrame): freq, method: FillnaOptions | None = None, how: Literal["start", "end"] | None = ..., - normalize: _bool = ..., + normalize: _bool = False, fill_value: Scalar | None = ..., ) -> Series[S1]: ... @final @@ -1452,14 +1452,14 @@ class Series(IndexOpsMixin[S1], NDFrame): self, time: _str | time, asof: _bool = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final def between_time( self, start_time: _str | time, end_time: _str | time, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final def first(self, offset) -> Series[S1]: ... @@ -1468,12 +1468,12 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def rank( self, - axis: AxisIndex = ..., - method: Literal["average", "min", "max", "first", "dense"] = ..., - numeric_only: _bool = ..., - na_option: Literal["keep", "top", "bottom"] = ..., - ascending: _bool = ..., - pct: _bool = ..., + axis: AxisIndex = 0, + method: Literal["average", "min", "max", "first", "dense"] = "average", + numeric_only: _bool = False, + na_option: Literal["keep", "top", "bottom"] = "keep", + ascending: _bool = True, + pct: _bool = False, ) -> Series[float]: ... @overload def where( @@ -1562,19 +1562,19 @@ class Series(IndexOpsMixin[S1], NDFrame): def tz_convert( self, tz: TimeZones, - axis: AxisIndex = ..., + axis: AxisIndex = 0, level: Level | None = None, - copy: _bool = ..., + copy: _bool = True, ) -> Series[S1]: ... @final def tz_localize( self, tz: TimeZones, - axis: AxisIndex = ..., + axis: AxisIndex = 0, level: Level | None = None, - copy: _bool = ..., - ambiguous: TimeAmbiguous = ..., - nonexistent: _str = ..., + copy: _bool = True, + ambiguous: TimeAmbiguous = "raise", + nonexistent: _str = "raise", ) -> Series[S1]: ... @final def abs(self) -> Series[S1]: ... @@ -1588,8 +1588,8 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def pct_change( self, - periods: int = ..., - fill_method: None = ..., + periods: int = 1, + fill_method: None = "pad", freq: DateOffset | timedelta | _str | None = ..., *, fill_value: Scalar | NAType | None = ..., @@ -1758,9 +1758,9 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def all( self, - axis: AxisIndex = ..., - bool_only: _bool | None = ..., - skipna: _bool = ..., + axis: AxisIndex = 0, + bool_only: _bool | None = False, + skipna: _bool = True, **kwargs: Any, ) -> np.bool: ... def any( @@ -1773,15 +1773,15 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> np.bool: ... def cummax( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Series[S1]: ... def cummin( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Series[S1]: ... @@ -1803,8 +1803,8 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def cumsum( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Series[S1]: ... @@ -1836,15 +1836,15 @@ class Series(IndexOpsMixin[S1], NDFrame): span: float | None = ..., halflife: float | None = ..., alpha: float | None = ..., - min_periods: int = ..., - adjust: _bool = ..., - ignore_na: _bool = ..., + min_periods: int = 0, + adjust: _bool = True, + ignore_na: _bool = False, ) -> ExponentialMovingWindow[Series]: ... @final def expanding( self, - min_periods: int = ..., - method: CalculationMethod = ..., + min_periods: int = 1, + method: CalculationMethod = "single", ) -> Expanding[Series]: ... def floordiv( self, @@ -1872,17 +1872,17 @@ class Series(IndexOpsMixin[S1], NDFrame): def kurt( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def kurtosis( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def le( @@ -1902,33 +1902,33 @@ class Series(IndexOpsMixin[S1], NDFrame): def max( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> S1: ... def mean( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def median( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def min( self, axis: AxisIndex | None = ..., - skipna: _bool = ..., + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> S1: ... def mod( @@ -1969,7 +1969,7 @@ class Series(IndexOpsMixin[S1], NDFrame): axis: AxisIndex = ..., ) -> Series[_bool]: ... @final - def nunique(self, dropna: _bool = ...) -> int: ... + def nunique(self, dropna: _bool = True) -> int: ... def pow( self, other: num | _ListLike | Series[S1], @@ -1980,17 +1980,17 @@ class Series(IndexOpsMixin[S1], NDFrame): def prod( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Scalar: ... def product( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Scalar: ... def radd( @@ -2087,24 +2087,24 @@ class Series(IndexOpsMixin[S1], NDFrame): def sem( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def skew( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def std( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def sub( @@ -2154,7 +2154,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def to_numpy( self, dtype: npt.DTypeLike | None = ..., - copy: bool = ..., + copy: bool = False, na_value: Scalar = ..., **kwargs: Any, ) -> np.ndarray: ... @@ -2169,9 +2169,9 @@ class Series(IndexOpsMixin[S1], NDFrame): def var( self, axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... # Rename axis with `mapper`, `axis`, and `inplace=True` @@ -2218,9 +2218,9 @@ class Series(IndexOpsMixin[S1], NDFrame): def xs( self, key: Hashable, - axis: AxisIndex = ..., + axis: AxisIndex = 0, level: Level | None = ..., - drop_level: _bool = ..., + drop_level: _bool = True, ) -> Self: ... @final def __bool__(self) -> NoReturn: ... diff --git a/pandas-stubs/core/util/hashing.pyi b/pandas-stubs/core/util/hashing.pyi index 946840872..e116fbb1b 100644 --- a/pandas-stubs/core/util/hashing.pyi +++ b/pandas-stubs/core/util/hashing.pyi @@ -12,14 +12,14 @@ from pandas._typing import ( def hash_pandas_object( obj: Index | Series | DataFrame, - index: bool = ..., - encoding: str = ..., + index: bool = True, + encoding: str = "utf8", hash_key: str | None = ..., - categorize: bool = ..., + categorize: bool = True, ) -> Series: ... def hash_array( vals: ArrayLike, - encoding: str = ..., + encoding: str = "utf8", hash_key: str = ..., - categorize: bool = ..., + categorize: bool = True, ) -> npt.NDArray[np.uint64]: ... diff --git a/pandas-stubs/core/window/ewm.pyi b/pandas-stubs/core/window/ewm.pyi index f35eb4375..157ab2f9d 100644 --- a/pandas-stubs/core/window/ewm.pyi +++ b/pandas-stubs/core/window/ewm.pyi @@ -16,35 +16,35 @@ from pandas._typing import ( class ExponentialMovingWindow(BaseWindow[NDFrameT]): def online( self, - engine: WindowingEngine = ..., + engine: WindowingEngine = "numba", engine_kwargs: WindowingEngineKwargs = None, ) -> OnlineExponentialMovingWindow[NDFrameT]: ... def mean( self, - numeric_only: bool = ..., + numeric_only: bool = False, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... def sum( self, - numeric_only: bool = ..., + numeric_only: bool = False, engine: WindowingEngine = None, engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... - def std(self, bias: bool = ..., numeric_only: bool = ...) -> NDFrameT: ... - def var(self, bias: bool = ..., numeric_only: bool = ...) -> NDFrameT: ... + def std(self, bias: bool = False, numeric_only: bool = False) -> NDFrameT: ... + def var(self, bias: bool = False, numeric_only: bool = False) -> NDFrameT: ... def cov( self, other: DataFrame | Series | None = ..., pairwise: bool | None = None, - bias: bool = ..., - numeric_only: bool = ..., + bias: bool = False, + numeric_only: bool = False, ) -> NDFrameT: ... def corr( self, other: DataFrame | Series | None = ..., pairwise: bool | None = None, - numeric_only: bool = ..., + numeric_only: bool = False, ) -> NDFrameT: ... class ExponentialMovingWindowGroupby( @@ -54,21 +54,21 @@ class ExponentialMovingWindowGroupby( class OnlineExponentialMovingWindow(ExponentialMovingWindow[NDFrameT]): def reset(self) -> None: ... def aggregate(self, func, *args, **kwargs): ... - def std(self, bias: bool = ..., *args, **kwargs): ... # pyrefly: ignore + def std(self, bias: bool = False, *args, **kwargs): ... # pyrefly: ignore def corr( self, other: DataFrame | Series | None = ..., pairwise: bool | None = None, - numeric_only: bool = ..., + numeric_only: bool = False, ): ... def cov( self, other: DataFrame | Series | None = ..., pairwise: bool | None = None, - bias: bool = ..., - numeric_only: bool = ..., + bias: bool = False, + numeric_only: bool = False, ): ... - def var(self, bias: bool = ..., numeric_only: bool = ...): ... + def var(self, bias: bool = False, numeric_only: bool = False): ... def mean( # pyrefly: ignore self, *args, update: NDFrameT | None = ..., update_times: None = ..., **kwargs ) -> NDFrameT: ... diff --git a/pandas-stubs/core/window/rolling.pyi b/pandas-stubs/core/window/rolling.pyi index 06774ef1a..99f4be386 100644 --- a/pandas-stubs/core/window/rolling.pyi +++ b/pandas-stubs/core/window/rolling.pyi @@ -68,13 +68,13 @@ class BaseWindow(SelectionMixin[NDFrameT]): class BaseWindowGroupby(BaseWindow[NDFrameT]): ... class Window(BaseWindow[NDFrameT]): - def sum(self, numeric_only: bool = ..., **kwargs: Any) -> NDFrameT: ... - def mean(self, numeric_only: bool = ..., **kwargs: Any) -> NDFrameT: ... + def sum(self, numeric_only: bool = False, **kwargs: Any) -> NDFrameT: ... + def mean(self, numeric_only: bool = False, **kwargs: Any) -> NDFrameT: ... def var( - self, ddof: int = ..., numeric_only: bool = ..., **kwargs: Any + self, ddof: int = ..., numeric_only: bool = False, **kwargs: Any ) -> NDFrameT: ... def std( - self, ddof: int = ..., numeric_only: bool = ..., **kwargs: Any + self, ddof: int = ..., numeric_only: bool = False, **kwargs: Any ) -> NDFrameT: ... class RollingAndExpandingMixin(BaseWindow[NDFrameT]): diff --git a/pandas-stubs/io/clipboards.pyi b/pandas-stubs/io/clipboards.pyi index 2aaba3806..c9ee302da 100644 --- a/pandas-stubs/io/clipboards.pyi +++ b/pandas-stubs/io/clipboards.pyi @@ -204,5 +204,5 @@ def read_clipboard( storage_options: StorageOptions | None = ..., ) -> DataFrame: ... def to_clipboard( - obj, excel: bool = ..., sep: str | None = ..., **kwargs: Any + obj, excel: bool = True, sep: str | None = ..., **kwargs: Any ) -> None: ... diff --git a/pandas-stubs/io/feather_format.pyi b/pandas-stubs/io/feather_format.pyi index 812668215..2bc423ad9 100644 --- a/pandas-stubs/io/feather_format.pyi +++ b/pandas-stubs/io/feather_format.pyi @@ -12,7 +12,7 @@ from pandas._typing import ( def read_feather( path: FilePath | ReadBuffer[bytes], columns: list[HashableT] | None = None, - use_threads: bool = ..., + use_threads: bool = True, storage_options: StorageOptions = ..., - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", ) -> DataFrame: ... diff --git a/pandas-stubs/io/formats/format.pyi b/pandas-stubs/io/formats/format.pyi index c26fbcf2f..5664617f4 100644 --- a/pandas-stubs/io/formats/format.pyi +++ b/pandas-stubs/io/formats/format.pyi @@ -7,4 +7,4 @@ class EngFormatter: ) -> None: ... def __call__(self, num: float) -> str: ... -def set_eng_float_format(accuracy: int = ..., use_eng_prefix: bool = ...) -> None: ... +def set_eng_float_format(accuracy: int = 3, use_eng_prefix: bool = False) -> None: ... diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index e546687c6..81fb8f935 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -99,19 +99,19 @@ class Styler(StylerRenderer): def to_excel( self, excel_writer: FilePath | WriteExcelBuffer | ExcelWriter, - sheet_name: str = ..., - na_rep: str = ..., + sheet_name: str = "Sheet1", + na_rep: str = "", float_format: str | None = ..., columns: list[HashableT1] | None = ..., - header: list[HashableT2] | bool = ..., - index: bool = ..., + header: list[HashableT2] | bool = True, + index: bool = True, index_label: IndexLabel | None = ..., - startrow: int = ..., - startcol: int = ..., + startrow: int = 0, + startcol: int = 0, engine: Literal["openpyxl", "xlsxwriter"] | None = ..., - merge_cells: ExcelWriterMergeCells = ..., + merge_cells: ExcelWriterMergeCells = True, encoding: str | None = ..., - inf_rep: str = ..., + inf_rep: str = "inf", verbose: bool = ..., freeze_panes: tuple[int, int] | None = ..., storage_options: StorageOptions | None = ..., @@ -263,15 +263,15 @@ class Styler(StylerRenderer): def set_caption(self, caption: str | tuple[str, str]) -> Styler: ... def set_sticky( self, - axis: Axis = ..., + axis: Axis = 0, pixel_size: int | None = ..., levels: Level | list[Level] | None = ..., ) -> Styler: ... def set_table_styles( self, table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = ..., - axis: Axis = ..., - overwrite: bool = ..., + axis: Axis = 0, + overwrite: bool = True, css_class_names: dict[str, str] | None = ..., ) -> Styler: ... def hide( @@ -286,7 +286,7 @@ class Styler(StylerRenderer): cmap: str | Colormap = ..., low: float = ..., high: float = ..., - axis: Axis | None = ..., + axis: Axis | None = 0, subset: Subset | None = ..., text_color_threshold: float = ..., vmin: float | None = ..., @@ -305,7 +305,7 @@ class Styler(StylerRenderer): cmap: str | Colormap = ..., low: float = ..., high: float = ..., - axis: Axis | None = ..., + axis: Axis | None = 0, subset: Subset | None = ..., # In docs but not in function declaration # text_color_threshold: float @@ -326,7 +326,7 @@ class Styler(StylerRenderer): def bar( self, subset: Subset | None = ..., - axis: Axis | None = ..., + axis: Axis | None = 0, *, color: str | list[str] | tuple[str, str] | None = ..., cmap: str | Colormap | None = ..., @@ -343,29 +343,29 @@ class Styler(StylerRenderer): ) -> Styler: ... def highlight_null( self, - color: str | None = ..., + color: str | None = "red", subset: Subset | None = ..., props: str | None = None, ) -> Styler: ... def highlight_max( self, subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., + color: str = "yellow", + axis: Axis | None = 0, props: str | None = None, ) -> Styler: ... def highlight_min( self, subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., + color: str = "yellow", + axis: Axis | None = 0, props: str | None = None, ) -> Styler: ... def highlight_between( self, subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., + color: str = "yellow", + axis: Axis | None = 0, left: Scalar | list[Scalar] | None = None, right: Scalar | list[Scalar] | None = None, inclusive: IntervalClosedType = ..., @@ -374,10 +374,10 @@ class Styler(StylerRenderer): def highlight_quantile( self, subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., - q_left: float = ..., - q_right: float = ..., + color: str = "yellow", + axis: Axis | None = 0, + q_left: float = 0, + q_right: float = 1, interpolation: QuantileInterpolation = ..., inclusive: IntervalClosedType = ..., props: str | None = None, diff --git a/pandas-stubs/io/formats/style_render.pyi b/pandas-stubs/io/formats/style_render.pyi index 57c7b4923..2dcc96629 100644 --- a/pandas-stubs/io/formats/style_render.pyi +++ b/pandas-stubs/io/formats/style_render.pyi @@ -62,7 +62,7 @@ class StylerRenderer: subset: Subset | None = ..., na_rep: str | None = ..., precision: int | None = ..., - decimal: str = ..., + decimal: str = ".", thousands: str | None = None, escape: str | None = ..., hyperlinks: Literal["html", "latex"] | None = ..., @@ -74,7 +74,7 @@ class StylerRenderer: level: Level | list[Level] | None = ..., na_rep: str | None = ..., precision: int | None = ..., - decimal: str = ..., + decimal: str = ".", thousands: str | None = None, escape: str | None = ..., hyperlinks: Literal["html", "latex"] | None = ..., diff --git a/pandas-stubs/io/json/_normalize.pyi b/pandas-stubs/io/json/_normalize.pyi index 42ee73900..828cedefc 100644 --- a/pandas-stubs/io/json/_normalize.pyi +++ b/pandas-stubs/io/json/_normalize.pyi @@ -8,7 +8,7 @@ def json_normalize( meta: str | list[str | list[str]] | None = None, meta_prefix: str | None = None, record_prefix: str | None = None, - errors: IgnoreRaise = ..., - sep: str = ..., + errors: IgnoreRaise = "raise", + sep: str = ".", max_level: int | None = None, ) -> DataFrame: ... diff --git a/pandas-stubs/io/json/_table_schema.pyi b/pandas-stubs/io/json/_table_schema.pyi index 30fa25b08..95bbef314 100644 --- a/pandas-stubs/io/json/_table_schema.pyi +++ b/pandas-stubs/io/json/_table_schema.pyi @@ -7,7 +7,7 @@ from pandas._typing import JSONSerializable def build_table_schema( data: DataFrame | Series, - index: bool = ..., - primary_key: bool | None = ..., - version: bool = ..., + index: bool = True, + primary_key: bool | None = True, + version: bool = True, ) -> dict[str, JSONSerializable]: ... diff --git a/pandas-stubs/io/orc.pyi b/pandas-stubs/io/orc.pyi index c6b985020..7039598e7 100644 --- a/pandas-stubs/io/orc.pyi +++ b/pandas-stubs/io/orc.pyi @@ -13,7 +13,7 @@ from pandas._typing import ( def read_orc( path: FilePath | ReadBuffer[bytes], columns: list[HashableT] | None = None, - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", # TODO type with the correct pyarrow types # filesystem: pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem filesystem: Any | None = None, diff --git a/pandas-stubs/io/parquet.pyi b/pandas-stubs/io/parquet.pyi index fef8ee3a6..6dd24a554 100644 --- a/pandas-stubs/io/parquet.pyi +++ b/pandas-stubs/io/parquet.pyi @@ -12,10 +12,10 @@ from pandas._typing import ( def read_parquet( path: FilePath | ReadBuffer[bytes], - engine: ParquetEngine = ..., + engine: ParquetEngine = "auto", columns: list[str] | None = ..., storage_options: StorageOptions = ..., - dtype_backend: DtypeBackend = ..., + dtype_backend: DtypeBackend = "numpy_nullable", filesystem: Any = None, filters: list[tuple] | list[list[tuple]] | None = None, **kwargs: Any, diff --git a/pandas-stubs/io/pickle.pyi b/pandas-stubs/io/pickle.pyi index b2ead7903..ade4dc059 100644 --- a/pandas-stubs/io/pickle.pyi +++ b/pandas-stubs/io/pickle.pyi @@ -11,12 +11,12 @@ from pandas._typing import ( def to_pickle( obj: object, filepath_or_buffer: FilePath | WriteBuffer[bytes], - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", protocol: int = ..., storage_options: StorageOptions = ..., ) -> None: ... def read_pickle( filepath_or_buffer: FilePath | ReadPickleBuffer, - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", storage_options: StorageOptions = ..., ) -> Any: ... diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 4dfa53d74..983402c8c 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -122,9 +122,9 @@ class HDFStore: exc_value: BaseException | None, traceback: TracebackType | None, ) -> None: ... - def keys(self, include=...) -> list[str]: ... + def keys(self, include="pandas") -> list[str]: ... def __iter__(self) -> Iterator[str]: ... - def open(self, mode: Literal["a", "w", "r", "r+"] = ..., **kwargs) -> None: ... + def open(self, mode: Literal["a", "w", "r", "r+"] = "a", **kwargs) -> None: ... def close(self) -> None: ... @property def is_open(self) -> bool: ... @@ -171,9 +171,9 @@ class HDFStore: self, key: str, value: NDFrame, - format: Literal["t", "table", "f", "fixed"] = ..., - index: bool = ..., - append: bool = ..., + format: Literal["t", "table", "f", "fixed"] = "fixed", + index: bool = True, + append: bool = False, complib: HDFCompLib | None = ..., complevel: int | None = ..., min_itemsize: int | dict[HashableT1, int] | None = ..., @@ -189,8 +189,8 @@ class HDFStore: "backslashreplace", "namereplace", ] = ..., - track_times: bool = ..., - dropna: bool = ..., + track_times: bool = True, + dropna: bool = False, ) -> None: ... def append( self, @@ -198,8 +198,8 @@ class HDFStore: value: NDFrame, format: Literal["t", "table", "f", "fixed"] = ..., axes: int | None = ..., - index: bool = ..., - append: bool = ..., + index: bool = True, + append: bool = True, complib: HDFCompLib | None = ..., complevel: int | None = ..., columns: list[HashableT1] | None = ..., @@ -207,7 +207,7 @@ class HDFStore: nan_rep: str | None = ..., chunksize: int | None = ..., expectedrows: int | None = ..., - dropna: bool | None = ..., + dropna: bool | None = False, data_columns: Literal[True] | list[HashableT3] | None = None, encoding: str | None = None, errors: Literal[ @@ -222,7 +222,7 @@ class HDFStore: ) -> None: ... def groups(self) -> list: ... def walk( - self, where: str = ... + self, where: str = "/" ) -> Generator[tuple[str, list, list[str]], None, None]: ... def info(self) -> str: ... diff --git a/pandas-stubs/io/spss.pyi b/pandas-stubs/io/spss.pyi index c5e66712d..5e94b6da5 100644 --- a/pandas-stubs/io/spss.pyi +++ b/pandas-stubs/io/spss.pyi @@ -11,5 +11,5 @@ def read_spss( path: FilePath, usecols: list[HashableT] | None = ..., convert_categoricals: bool = True, - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", ) -> DataFrame: ... diff --git a/pandas-stubs/io/stata.pyi b/pandas-stubs/io/stata.pyi index 5b5145aa9..e34d19fa5 100644 --- a/pandas-stubs/io/stata.pyi +++ b/pandas-stubs/io/stata.pyi @@ -105,13 +105,13 @@ class StataReader(StataParser, abc.Iterator): def read( self, nrows: int | None = ..., - convert_dates: bool | None = ..., - convert_categoricals: bool | None = ..., + convert_dates: bool | None = True, + convert_categoricals: bool | None = True, index_col: str | None = ..., - convert_missing: bool | None = ..., - preserve_dtypes: bool | None = ..., + convert_missing: bool | None = False, + preserve_dtypes: bool | None = True, columns: list[str] | None = ..., - order_categoricals: bool | None = ..., + order_categoricals: bool | None = True, ): ... @property def data_label(self) -> str: ... diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index d5f95352a..297467e90 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -40,7 +40,7 @@ def scatter_matrix( marker: str = ..., density_kwds: dict[str, Any] | None = ..., hist_kwds: dict[str, Any] | None = ..., - range_padding: float = ..., + range_padding: float = 0.05, **kwargs, ) -> npt.NDArray[np.object_]: ... def radviz( @@ -63,8 +63,8 @@ def andrews_curves( def bootstrap_plot( series: Series, fig: Figure | None = None, - size: int = ..., - samples: int = ..., + size: int = 50, + samples: int = 500, **kwds, ) -> Figure: ... def parallel_coordinates( @@ -78,10 +78,10 @@ def parallel_coordinates( colormap: str | Colormap | None = None, axvlines: bool = ..., axvlines_kwds: dict[str, Any] | None = ..., - sort_labels: bool = ..., + sort_labels: bool = False, **kwargs, ) -> Axes: ... -def lag_plot(series: Series, lag: int = ..., ax: Axes | None = ..., **kwds) -> Axes: ... +def lag_plot(series: Series, lag: int = 1, ax: Axes | None = ..., **kwds) -> Axes: ... def autocorrelation_plot(series: Series, ax: Axes | None = ..., **kwargs) -> Axes: ... plot_params: dict[str, Any] diff --git a/pandas-stubs/util/_doctools.pyi b/pandas-stubs/util/_doctools.pyi index 3d455cb44..39d4e007c 100644 --- a/pandas-stubs/util/_doctools.pyi +++ b/pandas-stubs/util/_doctools.pyi @@ -5,4 +5,4 @@ class TablePlotter: def __init__( self, cell_width: float = ..., cell_height: float = ..., font_size: float = ... ) -> None: ... - def plot(self, left, right, labels=..., vertical: bool = ...): ... + def plot(self, left, right, labels=..., vertical: bool = True): ... diff --git a/pandas-stubs/util/_print_versions.pyi b/pandas-stubs/util/_print_versions.pyi index 48b900adf..2464b5077 100644 --- a/pandas-stubs/util/_print_versions.pyi +++ b/pandas-stubs/util/_print_versions.pyi @@ -1 +1 @@ -def show_versions(as_json: bool = ...) -> None: ... +def show_versions(as_json: bool = False) -> None: ... diff --git a/pandas-stubs/util/_tester.pyi b/pandas-stubs/util/_tester.pyi index dc663b216..0dd6e1278 100644 --- a/pandas-stubs/util/_tester.pyi +++ b/pandas-stubs/util/_tester.pyi @@ -1 +1 @@ -def test(extra_args: list[str] | None = None, run_doctests: bool = ...) -> None: ... +def test(extra_args: list[str] | None = None, run_doctests: bool = False) -> None: ... From b544b4e567d511eb0daeb840c0151f41e2633f71 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Sun, 27 Jul 2025 15:37:54 -0400 Subject: [PATCH 05/17] fix deprecated function --- pandas-stubs/core/frame.pyi | 2 +- pandas-stubs/core/series.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 51339ff5c..b322d8fdf 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -2149,7 +2149,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def pct_change( self, periods: int = 1, - fill_method: None = "pad", + fill_method: None = None, freq: DateOffset | dt.timedelta | _str | None = ..., *, axis: Axis = ..., diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 22bcf6e0a..58bba76ea 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1589,7 +1589,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def pct_change( self, periods: int = 1, - fill_method: None = "pad", + fill_method: None = None, freq: DateOffset | timedelta | _str | None = ..., *, fill_value: Scalar | NAType | None = ..., From 29d2fd7e6773d41163494d54da633772e6276057 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Tue, 29 Jul 2025 09:08:10 -0400 Subject: [PATCH 06/17] apply defaults from source code --- pandas-stubs/_testing/__init__.pyi | 12 +++--- pandas-stubs/core/algorithms.pyi | 2 +- pandas-stubs/core/computation/eval.pyi | 6 +-- pandas-stubs/core/construction.pyi | 2 +- pandas-stubs/core/frame.pyi | 22 +++++----- pandas-stubs/core/indexes/datetimes.pyi | 8 ++-- pandas-stubs/core/indexes/period.pyi | 2 +- .../core/interchange/from_dataframe.pyi | 2 +- pandas-stubs/core/reshape/encoding.pyi | 2 +- pandas-stubs/core/reshape/melt.pyi | 6 +-- pandas-stubs/core/reshape/merge.pyi | 26 ++++++------ pandas-stubs/core/series.pyi | 4 +- pandas-stubs/io/clipboards.pyi | 2 +- pandas-stubs/io/feather_format.pyi | 2 +- pandas-stubs/io/parquet.pyi | 4 +- pandas-stubs/io/pickle.pyi | 4 +- pandas-stubs/io/spss.pyi | 2 +- pandas-stubs/plotting/_misc.pyi | 42 +++++++++---------- 18 files changed, 75 insertions(+), 75 deletions(-) diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index ed761d1a9..18b7aa959 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -41,7 +41,7 @@ def assert_almost_equal( atol: float = 1e-8, **kwargs, ) -> None: ... -def assert_dict_equal(left: dict, right: dict, compare_keys: bool = ...) -> None: ... +def assert_dict_equal(left: dict, right: dict, compare_keys: bool = True) -> None: ... def assert_index_equal( left: Index, right: Index, @@ -55,7 +55,7 @@ def assert_index_equal( obj: str = "Index", ) -> None: ... def assert_class_equal( - left: T, right: T, exact: bool | Literal["equiv"] = ..., obj: str = ... + left: T, right: T, exact: bool | Literal["equiv"] = True, obj: str = "Input" ) -> None: ... def assert_attr_equal( attr: str, left: object, right: object, obj: str = "Attributes" @@ -78,13 +78,13 @@ def assert_interval_array_equal( obj: str = "IntervalArray", ) -> None: ... def assert_period_array_equal( - left: PeriodArray, right: PeriodArray, obj: str = ... + left: PeriodArray, right: PeriodArray, obj: str = "PeriodArray" ) -> None: ... def assert_datetime_array_equal( - left: DatetimeArray, right: DatetimeArray, check_freq: bool = ... + left: DatetimeArray, right: DatetimeArray, check_freq: bool = True ) -> None: ... def assert_timedelta_array_equal( - left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = ... + left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = True ) -> None: ... def assert_numpy_array_equal( left, @@ -185,5 +185,5 @@ def assert_produces_warning( ) -> Generator[list[warnings.WarningMessage], None, None]: ... @contextmanager def ensure_clean( - filename: str | None = ..., return_filelike: bool = False, **kwargs: Any + filename: str | None = None, return_filelike: bool = False, **kwargs: Any ) -> Generator[str, None, None]: ... diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index ca8cb3c40..803878ba8 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -67,7 +67,7 @@ def value_counts( sort: bool = True, ascending: bool = False, normalize: bool = False, - bins: int | None = ..., + bins: int | None = None, dropna: bool = True, ) -> Series: ... def take( diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index 258051ab7..cfda7bd33 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -19,10 +19,10 @@ def eval( expr: str | BinOp, parser: Literal["pandas", "python"] = "pandas", engine: Literal["python", "numexpr"] | None = "numexpr", - local_dict: dict[str, Any] | None = ..., - global_dict: dict[str, Any] | None = ..., + local_dict: dict[str, Any] | None = None, + global_dict: dict[str, Any] | None = None, resolvers: list[Mapping] | None = ..., - level: int = ..., + level: int = 0, target: object | None = None, inplace: bool = False, ) -> npt.NDArray | Scalar | DataFrame | Series | None: ... diff --git a/pandas-stubs/core/construction.pyi b/pandas-stubs/core/construction.pyi index 3f723a4b1..e70207c19 100644 --- a/pandas-stubs/core/construction.pyi +++ b/pandas-stubs/core/construction.pyi @@ -7,6 +7,6 @@ from pandas.core.dtypes.dtypes import ExtensionDtype def array( data: Sequence[object], - dtype: str | np.dtype | ExtensionDtype | None = ..., + dtype: str | np.dtype | ExtensionDtype | None = None, copy: bool = True, ) -> ExtensionArray: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index b322d8fdf..3f72f49f8 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -1648,32 +1648,32 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def plot(self) -> PlotAccessor: ... def hist( self, - column: _str | list[_str] | None = ..., - by: _str | ListLike | None = ..., + column: _str | list[_str] | None = None, + by: _str | ListLike | None = None, grid: _bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, ylabelsize: float | str | None = None, yrot: float | None = None, ax: PlotAxes | None = None, - sharex: _bool = ..., + sharex: _bool = False, sharey: _bool = False, - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, bins: int | list = 10, backend: _str | None = None, **kwargs: Any, ): ... def boxplot( self, - column: _str | list[_str] | None = ..., - by: _str | ListLike | None = ..., - ax: PlotAxes | None = ..., - fontsize: float | _str | None = ..., + column: _str | list[_str] | None = None, + by: _str | ListLike | None = None, + ax: PlotAxes | None = None, + fontsize: float | _str | None = None, rot: float = 0, grid: _bool = True, - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, return_type: Literal["axes", "dict", "both"] | None = "axes", backend: _str | None = None, **kwargs: Any, diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index 5fb525805..d3f5957b6 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -99,11 +99,11 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): def shift(self, periods: int = 1, freq=...) -> Self: ... def date_range( - start: str | DateAndDatetimeLike | None = ..., - end: str | DateAndDatetimeLike | None = ..., - periods: int | None = ..., + start: str | DateAndDatetimeLike | None = None, + end: str | DateAndDatetimeLike | None = None, + periods: int | None = None, freq: str | timedelta | Timedelta | BaseOffset = "D", - tz: TimeZones = ..., + tz: TimeZones = None, normalize: bool = False, name: Hashable | None = None, inclusive: IntervalClosedType = "both", diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 015f52f6c..3331ab075 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -92,6 +92,6 @@ def period_range( str | datetime.datetime | datetime.date | pd.Timestamp | pd.Period | None ) = None, periods: int | None = None, - freq: str | BaseOffset | None = ..., + freq: str | BaseOffset | None = None, name: Hashable | None = None, ) -> PeriodIndex: ... diff --git a/pandas-stubs/core/interchange/from_dataframe.pyi b/pandas-stubs/core/interchange/from_dataframe.pyi index e34d805e5..8dc8e7e0f 100644 --- a/pandas-stubs/core/interchange/from_dataframe.pyi +++ b/pandas-stubs/core/interchange/from_dataframe.pyi @@ -1,3 +1,3 @@ import pandas as pd -def from_dataframe(df, allow_copy: bool = ...) -> pd.DataFrame: ... +def from_dataframe(df, allow_copy: bool = True) -> pd.DataFrame: ... diff --git a/pandas-stubs/core/reshape/encoding.pyi b/pandas-stubs/core/reshape/encoding.pyi index b5cd6e6d8..dac498e03 100644 --- a/pandas-stubs/core/reshape/encoding.pyi +++ b/pandas-stubs/core/reshape/encoding.pyi @@ -20,7 +20,7 @@ def get_dummies( columns: list[HashableT2] | None = None, sparse: bool = False, drop_first: bool = False, - dtype: Dtype | None = ..., + dtype: Dtype | None = None, ) -> DataFrame: ... def from_dummies( data: DataFrame, diff --git a/pandas-stubs/core/reshape/melt.pyi b/pandas-stubs/core/reshape/melt.pyi index f83b289ae..68a9ee57d 100644 --- a/pandas-stubs/core/reshape/melt.pyi +++ b/pandas-stubs/core/reshape/melt.pyi @@ -7,11 +7,11 @@ from pandas._typing import HashableT def melt( frame: DataFrame, - id_vars: tuple | list | np.ndarray | None = ..., - value_vars: tuple | list | np.ndarray | None = ..., + id_vars: tuple | list | np.ndarray | None = None, + value_vars: tuple | list | np.ndarray | None = None, var_name: str | None = None, value_name: Hashable = "value", - col_level: int | str | None = ..., + col_level: int | str | None = None, ignore_index: bool = True, ) -> DataFrame: ... def lreshape( diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index b0c2af537..4b307df4d 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -24,15 +24,15 @@ def merge( left: DataFrame | Series, right: DataFrame | Series, how: MergeHow = "inner", - on: Label | list[HashableT] | AnyArrayLike | None = ..., - left_on: Label | list[HashableT] | AnyArrayLike | None = ..., - right_on: Label | list[HashableT] | AnyArrayLike | None = ..., + on: Label | list[HashableT] | AnyArrayLike | None = None, + left_on: Label | list[HashableT] | AnyArrayLike | None = None, + right_on: Label | list[HashableT] | AnyArrayLike | None = None, left_index: bool = False, right_index: bool = False, sort: bool = False, suffixes: Suffixes = ..., indicator: bool | str = False, - validate: ValidationOptions = ..., + validate: ValidationOptions = None, ) -> DataFrame: ... @overload def merge_ordered( @@ -78,16 +78,16 @@ def merge_ordered( def merge_asof( left: DataFrame | Series, right: DataFrame | Series, - on: Label | None = ..., - left_on: Label | None = ..., - right_on: Label | None = ..., - left_index: bool = ..., - right_index: bool = ..., - by: Label | list[HashableT] | None = ..., - left_by: Label | list[HashableT] | None = ..., - right_by: Label | list[HashableT] | None = ..., + on: Label | None = None, + left_on: Label | None = None, + right_on: Label | None = None, + left_index: bool = False, + right_index: bool = False, + by: Label | list[HashableT] | None = None, + left_by: Label | list[HashableT] | None = None, + right_by: Label | list[HashableT] | None = None, suffixes: Suffixes = ..., tolerance: int | timedelta | Timedelta | None = None, allow_exact_matches: bool = True, - direction: Literal["backward", "forward", "nearest"] = ..., + direction: Literal["backward", "forward", "nearest"] = "backward", ) -> DataFrame: ... diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 58bba76ea..4bc483739 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1208,8 +1208,8 @@ class Series(IndexOpsMixin[S1], NDFrame): sparse = ... def hist( self, - by: object | None = ..., - ax: PlotAxes | None = ..., + by: object | None = None, + ax: PlotAxes | None = None, grid: _bool = True, xlabelsize: float | _str | None = None, xrot: float | None = None, diff --git a/pandas-stubs/io/clipboards.pyi b/pandas-stubs/io/clipboards.pyi index c9ee302da..28dcb2367 100644 --- a/pandas-stubs/io/clipboards.pyi +++ b/pandas-stubs/io/clipboards.pyi @@ -204,5 +204,5 @@ def read_clipboard( storage_options: StorageOptions | None = ..., ) -> DataFrame: ... def to_clipboard( - obj, excel: bool = True, sep: str | None = ..., **kwargs: Any + obj, excel: bool = True, sep: str | None = None, **kwargs: Any ) -> None: ... diff --git a/pandas-stubs/io/feather_format.pyi b/pandas-stubs/io/feather_format.pyi index 2bc423ad9..5861da0a0 100644 --- a/pandas-stubs/io/feather_format.pyi +++ b/pandas-stubs/io/feather_format.pyi @@ -13,6 +13,6 @@ def read_feather( path: FilePath | ReadBuffer[bytes], columns: list[HashableT] | None = None, use_threads: bool = True, - storage_options: StorageOptions = ..., + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", ) -> DataFrame: ... diff --git a/pandas-stubs/io/parquet.pyi b/pandas-stubs/io/parquet.pyi index 6dd24a554..c9c9bd154 100644 --- a/pandas-stubs/io/parquet.pyi +++ b/pandas-stubs/io/parquet.pyi @@ -13,8 +13,8 @@ from pandas._typing import ( def read_parquet( path: FilePath | ReadBuffer[bytes], engine: ParquetEngine = "auto", - columns: list[str] | None = ..., - storage_options: StorageOptions = ..., + columns: list[str] | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend = "numpy_nullable", filesystem: Any = None, filters: list[tuple] | list[list[tuple]] | None = None, diff --git a/pandas-stubs/io/pickle.pyi b/pandas-stubs/io/pickle.pyi index ade4dc059..4b0734904 100644 --- a/pandas-stubs/io/pickle.pyi +++ b/pandas-stubs/io/pickle.pyi @@ -13,10 +13,10 @@ def to_pickle( filepath_or_buffer: FilePath | WriteBuffer[bytes], compression: CompressionOptions = "infer", protocol: int = ..., - storage_options: StorageOptions = ..., + storage_options: StorageOptions = None, ) -> None: ... def read_pickle( filepath_or_buffer: FilePath | ReadPickleBuffer, compression: CompressionOptions = "infer", - storage_options: StorageOptions = ..., + storage_options: StorageOptions = None, ) -> Any: ... diff --git a/pandas-stubs/io/spss.pyi b/pandas-stubs/io/spss.pyi index 5e94b6da5..c2d121556 100644 --- a/pandas-stubs/io/spss.pyi +++ b/pandas-stubs/io/spss.pyi @@ -9,7 +9,7 @@ from pandas._typing import ( def read_spss( path: FilePath, - usecols: list[HashableT] | None = ..., + usecols: list[HashableT] | None = None, convert_categoricals: bool = True, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", ) -> DataFrame: ... diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index 297467e90..c52ca2569 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -32,22 +32,22 @@ def register() -> None: ... def deregister() -> None: ... def scatter_matrix( frame: DataFrame, - alpha: float = ..., - figsize: tuple[float, float] | None = ..., - ax: Axes | None = ..., - grid: bool = ..., - diagonal: Literal["hist", "kde"] = ..., - marker: str = ..., - density_kwds: dict[str, Any] | None = ..., - hist_kwds: dict[str, Any] | None = ..., + alpha: float = 0.5, + figsize: tuple[float, float] | None = None, + ax: Axes | None = None, + grid: bool = False, + diagonal: Literal["hist", "kde"] = "hist", + marker: str = ".", + density_kwds: dict[str, Any] | None = None, + hist_kwds: dict[str, Any] | None = None, range_padding: float = 0.05, **kwargs, ) -> npt.NDArray[np.object_]: ... def radviz( frame: DataFrame, class_column: Hashable, - ax: Axes | None = ..., - color: _Color | Sequence[_Color] | None = ..., + ax: Axes | None = None, + color: _Color | Sequence[_Color] | None = None, colormap: str | Colormap | None = None, **kwds, ) -> Axes: ... @@ -55,8 +55,8 @@ def andrews_curves( frame: DataFrame, class_column: Hashable, ax: Axes | None = None, - samples: int = ..., - color: _Color | Sequence[_Color] | None = ..., + samples: int = 200, + color: _Color | Sequence[_Color] | None = None, colormap: str | Colormap | None = None, **kwargs, ) -> Axes: ... @@ -70,18 +70,18 @@ def bootstrap_plot( def parallel_coordinates( frame: DataFrame, class_column: Hashable, - cols: list[HashableT] | None = ..., - ax: Axes | None = ..., - color: _Color | Sequence[_Color] | None = ..., - use_columns: bool = ..., - xticks: Sequence[float] | None = ..., + cols: list[HashableT] | None = None, + ax: Axes | None = None, + color: _Color | Sequence[_Color] | None = None, + use_columns: bool = False, + xticks: Sequence[float] | None = None, colormap: str | Colormap | None = None, - axvlines: bool = ..., - axvlines_kwds: dict[str, Any] | None = ..., + axvlines: bool = True, + axvlines_kwds: dict[str, Any] | None = None, sort_labels: bool = False, **kwargs, ) -> Axes: ... -def lag_plot(series: Series, lag: int = 1, ax: Axes | None = ..., **kwds) -> Axes: ... -def autocorrelation_plot(series: Series, ax: Axes | None = ..., **kwargs) -> Axes: ... +def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Axes: ... +def autocorrelation_plot(series: Series, ax: Axes | None = None, **kwargs) -> Axes: ... plot_params: dict[str, Any] From ba9d227cdb56f19e7a46448e703ea072af1922f5 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Tue, 29 Jul 2025 09:16:20 -0400 Subject: [PATCH 07/17] address some comments and fix mypy --- pandas-stubs/core/reshape/merge.pyi | 2 +- pandas-stubs/core/series.pyi | 116 ++++++++++++++-------------- 2 files changed, 58 insertions(+), 60 deletions(-) diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index 4b307df4d..cf5243cd2 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -32,7 +32,7 @@ def merge( sort: bool = False, suffixes: Suffixes = ..., indicator: bool | str = False, - validate: ValidationOptions = None, + validate: ValidationOptions | None = None, ) -> DataFrame: ... @overload def merge_ordered( diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 4bc483739..70d989b0e 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -484,7 +484,7 @@ class Series(IndexOpsMixin[S1], NDFrame): @overload def get(self, key: Hashable, default: _T) -> S1 | _T: ... def repeat( - self, repeats: int | list[int], axis: AxisIndex | None = ... + self, repeats: int | list[int], axis: AxisIndex | None = 0 ) -> Series[S1]: ... @property def index(self) -> Index | MultiIndex: ... @@ -1140,7 +1140,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def shift( self, periods: int | Sequence[int] = ..., - freq: DateOffset | timedelta | _str | None = ..., + freq: DateOffset | timedelta | _str | None = None, axis: Axis | None = None, fill_value: Scalar | NAType | None = ..., ) -> Series: ... @@ -1346,7 +1346,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def ffill( self, *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], limit: int | None = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -1355,7 +1355,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def ffill( self, *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[False] = ..., limit: int | None = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -1364,7 +1364,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def bfill( self, *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], limit: int | None = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -1373,7 +1373,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def bfill( self, *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[False] = ..., limit: int | None = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -1383,7 +1383,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, method: InterpolateOptions = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, limit: int | None = ..., inplace: Literal[True], limit_direction: Literal["forward", "backward", "both"] | None = ..., @@ -1395,7 +1395,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, method: InterpolateOptions = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, limit: int | None = ..., inplace: Literal[False] = ..., limit_direction: Literal["forward", "backward", "both"] | None = ..., @@ -1414,7 +1414,7 @@ class Series(IndexOpsMixin[S1], NDFrame): lower: None = ..., upper: None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], **kwargs: Any, ) -> Self: ... @@ -1424,7 +1424,7 @@ class Series(IndexOpsMixin[S1], NDFrame): lower: AnyArrayLike | float | None = ..., upper: AnyArrayLike | float | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], **kwargs: Any, ) -> None: ... @@ -1434,7 +1434,7 @@ class Series(IndexOpsMixin[S1], NDFrame): lower: AnyArrayLike | float | None = ..., upper: AnyArrayLike | float | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[False] = ..., **kwargs: Any, ) -> Series[S1]: ... @@ -1488,7 +1488,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other=..., *, inplace: Literal[True], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> None: ... @overload @@ -1504,7 +1504,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other=..., *, inplace: Literal[False] = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> Self: ... @overload @@ -1520,7 +1520,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other: Scalar | Series[S1] | DataFrame | Callable | NAType | None = ..., *, inplace: Literal[True], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> None: ... @overload @@ -1536,7 +1536,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other: Scalar | Series[S1] | DataFrame | Callable | NAType | None = ..., *, inplace: Literal[False] = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> Series[S1]: ... def case_when( @@ -1555,7 +1555,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, before: date | _str | int | None = ..., after: date | _str | int | None = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, copy: _bool = ..., ) -> Series[S1]: ... @final @@ -1590,9 +1590,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, periods: int = 1, fill_method: None = None, - freq: DateOffset | timedelta | _str | None = ..., - *, - fill_value: Scalar | NAType | None = ..., + freq: DateOffset | timedelta | _str | None = None, ) -> Series[float]: ... @final def first_valid_index(self) -> Scalar: ... @@ -1832,10 +1830,10 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def ewm( self, - com: float | None = ..., - span: float | None = ..., - halflife: float | None = ..., - alpha: float | None = ..., + com: float | None = None, + span: float | None = None, + halflife: float | None = None, + alpha: float | None = None, min_periods: int = 0, adjust: _bool = True, ignore_na: _bool = False, @@ -1851,7 +1849,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[int]: ... def ge( self, @@ -1871,7 +1869,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def item(self) -> S1: ... def kurt( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1879,7 +1877,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Scalar: ... def kurtosis( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1901,7 +1899,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[_bool]: ... def max( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1909,7 +1907,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> S1: ... def mean( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1917,7 +1915,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> float: ... def median( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1925,7 +1923,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> float: ... def min( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = True, level: None = ..., numeric_only: _bool = False, @@ -1936,30 +1934,30 @@ class Series(IndexOpsMixin[S1], NDFrame): other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @overload def mul( self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64, level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> TimedeltaSeries: ... @overload def mul( self, other: num | _ListLike | Series, level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> Series: ... def multiply( self, other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... def ne( self, @@ -1975,11 +1973,11 @@ class Series(IndexOpsMixin[S1], NDFrame): other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... def prod( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, numeric_only: _bool = False, min_count: int = 0, @@ -1987,7 +1985,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Scalar: ... def product( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, numeric_only: _bool = False, min_count: int = 0, @@ -2026,7 +2024,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: timedelta | Timedelta | TimedeltaSeries | np.timedelta64, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> TimedeltaSeries: ... @overload @@ -2034,7 +2032,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: num | _ListLike | Series, level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, axis: AxisIndex = ..., ) -> Series: ... @overload @@ -2086,7 +2084,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def sem( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, ddof: int = 1, numeric_only: _bool = False, @@ -2094,14 +2092,14 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Scalar: ... def skew( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def std( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, ddof: int = 1, numeric_only: _bool = False, @@ -2112,19 +2110,19 @@ class Series(IndexOpsMixin[S1], NDFrame): other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... def subtract( self, other: num | _ListLike | Series[S1], level: Level | None = ..., fill_value: float | None = None, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @overload def sum( self: Series[Never], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = ..., numeric_only: _bool = ..., min_count: int = ..., @@ -2134,7 +2132,7 @@ class Series(IndexOpsMixin[S1], NDFrame): @overload def sum( self: Series[bool], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = ..., numeric_only: _bool = ..., min_count: int = ..., @@ -2143,7 +2141,7 @@ class Series(IndexOpsMixin[S1], NDFrame): @overload def sum( self: Series[S1], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = ..., numeric_only: _bool = ..., min_count: int = ..., @@ -2168,7 +2166,7 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[float]: ... def var( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = True, ddof: int = 1, numeric_only: _bool = False, @@ -2180,7 +2178,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, mapper: Scalar | ListLike | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, copy: _bool = ..., inplace: Literal[True], ) -> None: ... @@ -2190,7 +2188,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, mapper: Scalar | ListLike | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, copy: _bool = ..., inplace: Literal[False] = ..., ) -> Self: ... @@ -2246,7 +2244,7 @@ class TimestampSeries(Series[Timestamp]): def unique(self) -> DatetimeArray: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def mean( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = ..., level: None = ..., numeric_only: _bool = ..., @@ -2254,7 +2252,7 @@ class TimestampSeries(Series[Timestamp]): ) -> Timestamp: ... def median( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = ..., level: None = ..., numeric_only: _bool = ..., @@ -2262,7 +2260,7 @@ class TimestampSeries(Series[Timestamp]): ) -> Timestamp: ... def std( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = ..., ddof: int = ..., numeric_only: _bool = ..., @@ -2350,7 +2348,7 @@ class TimedeltaSeries(Series[Timedelta]): def dt(self) -> TimedeltaProperties: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def mean( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = ..., level: None = ..., numeric_only: _bool = ..., @@ -2358,7 +2356,7 @@ class TimedeltaSeries(Series[Timedelta]): ) -> Timedelta: ... def median( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = ..., level: None = ..., numeric_only: _bool = ..., @@ -2366,7 +2364,7 @@ class TimedeltaSeries(Series[Timedelta]): ) -> Timedelta: ... def std( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool | None = ..., level: None = ..., ddof: int = ..., @@ -2376,7 +2374,7 @@ class TimedeltaSeries(Series[Timedelta]): def diff(self, periods: int = ...) -> TimedeltaSeries: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def cumsum( self, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, skipna: _bool = ..., *args: Any, **kwargs: Any, From e0860680d80047c35ed45b0feec770ed8d9f1131 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Tue, 29 Jul 2025 09:19:18 -0400 Subject: [PATCH 08/17] remove fill_value from tests --- tests/test_series.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/test_series.py b/tests/test_series.py index f58d651f4..37441a5c2 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -470,11 +470,6 @@ def test_series_pct_change() -> None: pd.Series, np.floating, ) - check( - assert_type(s.pct_change(fill_value=0), "pd.Series[float]"), - pd.Series, - np.floating, - ) def test_types_rank() -> None: From 06bb3bff67ec3241d7332686e58b4e5c56ac62a0 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 10:05:37 -0400 Subject: [PATCH 09/17] address some comments --- pandas-stubs/_libs/tslibs/timestamps.pyi | 14 ++++++- pandas-stubs/core/computation/eval.pyi | 2 +- pandas-stubs/core/frame.pyi | 47 ++++++++---------------- pandas-stubs/core/generic.pyi | 15 +++----- 4 files changed, 35 insertions(+), 43 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 26afc7744..55dcdfefc 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -157,7 +157,19 @@ class Timestamp(datetime, SupportsIndex): ) -> Timestamp: ... def astimezone(self, tz: _tzinfo | None = ...) -> Self: ... def ctime(self) -> str: ... - def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ... + def isoformat( + self, + sep: str = "T", + timespec: Literal[ + "auto", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + ] = "auto", + ) -> str: ... @classmethod def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def utcoffset(self) -> timedelta | None: ... diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index cfda7bd33..19df29909 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -18,7 +18,7 @@ from pandas._typing import ( def eval( expr: str | BinOp, parser: Literal["pandas", "python"] = "pandas", - engine: Literal["python", "numexpr"] | None = "numexpr", + engine: Literal["python", "numexpr"] | None = ..., local_dict: dict[str, Any] | None = None, global_dict: dict[str, Any] | None = None, resolvers: list[Mapping] | None = ..., diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 3f72f49f8..b96ca1553 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -455,29 +455,15 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): into: type[dict] = ..., index: bool = ..., ) -> dict[Hashable, Any]: ... - def to_gbq( - self, - destination_table: str, - project_id: str | None = ..., - chunksize: int | None = ..., - reauth: bool = False, - if_exists: Literal["fail", "replace", "append"] = "fail", - auth_local_webserver: bool = True, - table_schema: list[dict[str, str]] | None = ..., - location: str | None = ..., - progress_bar: bool = True, - # Google type, not available - credentials: Any = ..., - ) -> None: ... @classmethod def from_records( cls, data, index=..., - exclude=None, - columns=None, - coerce_float=False, - nrows=None, + exclude: Sequence[str] | None = None, + columns: Sequence[str] | None = None, + coerce_float: bool = False, + nrows: int | None = None, ) -> Self: ... def to_records( self, @@ -1321,7 +1307,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): margins: _bool = False, dropna: _bool = True, margins_name: _str = "All", - observed: _bool = False, + observed: _bool = True, sort: _bool = True, ) -> Self: ... @overload @@ -1338,7 +1324,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def unstack( self, level: IndexLabel = -1, - fill_value: Scalar | None = ..., + fill_value: Scalar | None = None, sort: _bool = True, ) -> Self | Series: ... def melt( @@ -1560,20 +1546,20 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): suffixes: Suffixes = ..., copy: _bool = True, indicator: _bool | _str = False, - validate: MergeValidate | None = ..., + validate: MergeValidate | None = None, ) -> Self: ... def round( self, decimals: int | dict | Series = ..., *args: Any, **kwargs: Any ) -> Self: ... def corr( self, - method: Literal["pearson", "kendall", "spearman"] = ..., + method: Literal["pearson", "kendall", "spearman"] = "pearson", min_periods: int = ..., numeric_only: _bool = False, ) -> Self: ... def cov( self, - min_periods: int | None = ..., + min_periods: int | None = None, ddof: int = 1, numeric_only: _bool = False, ) -> Self: ... @@ -1639,7 +1625,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): ) -> Self: ... def to_period( self, - freq: _str | None = ..., + freq: _str | None = None, axis: Axis = 0, copy: _bool = True, ) -> Self: ... @@ -1790,7 +1776,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def at_time( self, time: _str | dt.time, - asof: _bool = ..., + asof: _bool = False, axis: Axis | None = 0, ) -> Self: ... @final @@ -1892,28 +1878,28 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def copy(self, deep: _bool = True) -> Self: ... def cummax( self, - axis: Axis | None = 0, + axis: Axis | None = None, skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cummin( self, - axis: Axis | None = 0, + axis: Axis | None = None, skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cumprod( self, - axis: Axis | None = 0, + axis: Axis | None = None, skipna: _bool = True, *args: Any, **kwargs: Any, ) -> Self: ... def cumsum( self, - axis: Axis | None = 0, + axis: Axis | None = None, skipna: _bool = True, *args: Any, **kwargs: Any, @@ -1999,8 +1985,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): level: Level | None = ..., fill_value: float | None = None, ) -> Self: ... - # def from_dict - # def from_records def ge(self, other, axis: Axis = "columns", level: Level | None = ...) -> Self: ... @overload def get(self, key: Hashable, default: None = ...) -> Series | None: ... @@ -2015,7 +1999,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def head(self, n: int = 5) -> Self: ... @final def infer_objects(self) -> Self: ... - # def info @overload def interpolate( self, diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 8b7dc86e4..dca42ee96 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -57,7 +57,6 @@ from pandas._typing import ( TimedeltaConvertibleTypes, TimeGrouperOrigin, TimestampConvertibleTypes, - ToTimestampHow, WriteBuffer, ) @@ -182,14 +181,14 @@ class NDFrame(indexing.IndexingMixin): self, path: FilePath | WriteBuffer[bytes], compression: CompressionOptions = "infer", - protocol: int = ..., + protocol: int = 5, storage_options: StorageOptions = ..., ) -> None: ... @final def to_clipboard( self, excel: _bool = True, - sep: _str | None = "\t", + sep: _str | None = None, *, na_rep: _str = ..., float_format: _str | Callable[[object], _str] | None = ..., @@ -413,8 +412,8 @@ class NDFrame(indexing.IndexingMixin): infer_objects: _bool = True, convert_string: _bool = True, convert_integer: _bool = True, - convert_boolean: _bool = ..., - convert_floating: _bool = ..., + convert_boolean: _bool = True, + convert_floating: _bool = True, dtype_backend: DtypeBackend = "numpy_nullable", ) -> Self: ... @final @@ -424,10 +423,8 @@ class NDFrame(indexing.IndexingMixin): axis: Axis | _NoDefaultDoNotUse = 0, closed: Literal["right", "left"] | None = None, label: Literal["right", "left"] | None = None, - convention: ToTimestampHow = "start", - kind: Literal["period", "timestamp"] | None = None, - on: Level | None = ..., - level: Level | None = ..., + on: Level | None = None, + level: Level | None = None, origin: TimeGrouperOrigin | TimestampConvertibleTypes = "start_day", offset: TimedeltaConvertibleTypes | None = None, group_keys: _bool = False, From e659f9e0d027b87dd77e73f9595f66cac9133109 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 10:25:13 -0400 Subject: [PATCH 10/17] address more comments --- pandas-stubs/core/groupby/generic.pyi | 16 +++++------ pandas-stubs/core/groupby/groupby.pyi | 20 +++++++------ pandas-stubs/core/indexes/base.pyi | 22 +++++++++++---- pandas-stubs/core/indexes/category.pyi | 5 ---- pandas-stubs/core/indexes/datetimelike.pyi | 30 -------------------- pandas-stubs/core/indexes/datetimes.pyi | 9 ++++-- pandas-stubs/core/indexes/multi.pyi | 33 ++++++---------------- pandas-stubs/core/indexes/period.pyi | 4 --- pandas-stubs/core/indexes/range.pyi | 3 +- pandas-stubs/core/indexes/timedeltas.pyi | 3 +- pandas-stubs/core/util/hashing.pyi | 4 +-- pandas-stubs/core/window/ewm.pyi | 13 +++------ pandas-stubs/io/clipboards.pyi | 3 -- 13 files changed, 59 insertions(+), 106 deletions(-) diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index a1946eed1..75430c052 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -179,7 +179,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): def cov( self, other: Series, - min_periods: int | None = ..., + min_periods: int | None = None, ddof: int | None = 1, ) -> Series: ... @property @@ -188,8 +188,8 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): def is_monotonic_decreasing(self) -> Series[bool]: ... def hist( self, - by: IndexLabel | None = ..., - ax: PlotAxes | None = ..., + by: IndexLabel | None = None, + ax: PlotAxes | None = None, grid: bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, @@ -424,18 +424,18 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): ) -> DataFrame: ... def hist( self, - column: IndexLabel | None = ..., - by: IndexLabel | None = ..., + column: IndexLabel | None = None, + by: IndexLabel | None = None, grid: bool = True, xlabelsize: float | str | None = None, xrot: float | None = None, ylabelsize: float | str | None = None, yrot: float | None = None, ax: PlotAxes | None = None, - sharex: bool = ..., + sharex: bool = False, sharey: bool = False, - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, bins: int | Sequence[int] = 10, backend: str | None = None, legend: bool = False, diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index 80d6effc0..1490e7d17 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -177,9 +177,13 @@ class GroupBy(BaseGroupBy[NDFrameT]): engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... @final - def first(self, numeric_only: bool = False, min_count: int = -1) -> NDFrameT: ... + def first( + self, numeric_only: bool = False, min_count: int = -1, skipna: bool = True + ) -> NDFrameT: ... @final - def last(self, numeric_only: bool = False, min_count: int = -1) -> NDFrameT: ... + def last( + self, numeric_only: bool = False, min_count: int = -1, skipna: bool = True + ) -> NDFrameT: ... @final def ohlc(self) -> DataFrame: ... def describe( @@ -215,11 +219,11 @@ class GroupBy(BaseGroupBy[NDFrameT]): center: bool | None = False, win_type: str | None = None, axis: Axis = 0, - on: str | Index | None = ..., + on: str | Index | None = None, closed: IntervalClosedType | None = None, method: CalculationMethod = "single", *, - selection: IndexLabel | None = ..., + selection: IndexLabel | None = None, ) -> RollingGroupby[NDFrameT]: ... @final def expanding( @@ -256,7 +260,7 @@ class GroupBy(BaseGroupBy[NDFrameT]): def quantile( self, q: float | AnyArrayLike = 0.5, - interpolation: str = ..., + interpolation: str = "linear", numeric_only: bool = False, ) -> NDFrameT: ... @final @@ -323,8 +327,8 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def sample( self, - n: int | None = ..., - frac: float | None = ..., + n: int | None = None, + frac: float | None = None, replace: bool = False, weights: Sequence | Series | None = ..., random_state: RandomState | None = ..., @@ -371,7 +375,7 @@ class BaseGroupBy(SelectionMixin[NDFrameT], GroupByIndexingMixin): **kwargs: Any, ) -> T: ... @final - def get_group(self, name, obj: NDFrameT | None = None) -> NDFrameT: ... + def get_group(self, name) -> NDFrameT: ... @final def __iter__(self) -> Iterator[tuple[Hashable, NDFrameT]]: ... @overload diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index 9eac1848a..19d49b639 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -44,16 +44,19 @@ from pandas._libs.interval import _OrderableT from pandas._typing import ( S1, AnyAll, + ArrayLike, AxesData, DropKeep, DtypeArg, DtypeObj, HashableT, + IgnoreRaise, Label, Level, MaskType, NaPosition, ReindexMethod, + Scalar, SliceType, TimedeltaDtypeArg, TimestampDtypeArg, @@ -290,9 +293,9 @@ class Index(IndexOpsMixin[S1]): def take( self, indices, - axis: int = ..., + axis: int = 0, allow_fill: bool = True, - fill_value=None, + fill_value: Scalar | None = None, **kwargs, ): ... def repeat(self, repeats, axis=...): ... @@ -397,7 +400,7 @@ class Index(IndexOpsMixin[S1]): @property def array(self) -> ExtensionArray: ... def memory_usage(self, deep: bool = False): ... - def where(self, cond, other=None): ... + def where(self, cond, other: Scalar | ArrayLike | None = None): ... def __contains__(self, key) -> bool: ... @final def __setitem__(self, key, value) -> None: ... @@ -434,12 +437,19 @@ class Index(IndexOpsMixin[S1]): def groupby(self, values) -> dict[Hashable, np.ndarray]: ... def map(self, mapper, na_action=...) -> Index: ... def isin(self, values, level=...) -> np_ndarray_bool: ... - def slice_indexer(self, start=None, end=None, step=None): ... + def slice_indexer( + self, + start: Label | None = None, + end: Label | None = None, + step: int | None = None, + ): ... def get_slice_bound(self, label, side): ... - def slice_locs(self, start: SliceType = None, end: SliceType = None, step=...): ... + def slice_locs( + self, start: SliceType = None, end: SliceType = None, step: int | None = None + ): ... def delete(self, loc) -> Self: ... def insert(self, loc, item) -> Self: ... - def drop(self, labels, errors: _str = "raise") -> Self: ... + def drop(self, labels, errors: IgnoreRaise = "raise") -> Self: ... @property def shape(self) -> tuple[int, ...]: ... # Extra methods from old stubs diff --git a/pandas-stubs/core/indexes/category.pyi b/pandas-stubs/core/indexes/category.pyi index fa05ad240..47c248970 100644 --- a/pandas-stubs/core/indexes/category.pyi +++ b/pandas-stubs/core/indexes/category.pyi @@ -3,7 +3,6 @@ from collections.abc import ( Iterable, ) from typing import ( - Literal, final, ) @@ -39,7 +38,6 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): def __array__( self, dtype: DtypeArg = ..., copy: bool | None = ... ) -> np.ndarray: ... - def astype(self, dtype: DtypeArg, copy: bool = True) -> Index: ... def fillna(self, value=...): ... @property def is_unique(self) -> bool: ... @@ -48,9 +46,6 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate): @property def is_monotonic_decreasing(self) -> bool: ... def unique(self, level=...): ... - def duplicated(self, keep: Literal["first", "last", False] = "first"): ... - @final - def where(self, cond, other=None): ... def reindex(self, target, method=..., level=..., limit=..., tolerance=...): ... @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index 41e7df85a..bba51a6f0 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -1,4 +1,3 @@ -import numpy as np from pandas.core.indexes.extension import ExtensionIndex from pandas.core.indexes.timedeltas import TimedeltaIndex from typing_extensions import Self @@ -6,7 +5,6 @@ from typing_extensions import Self from pandas._libs.tslibs import BaseOffset from pandas._typing import ( S1, - AxisIndex, TimeUnit, ) @@ -17,34 +15,6 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]): def freqstr(self) -> str | None: ... @property def is_all_dates(self) -> bool: ... - def min( - self, - axis: AxisIndex | None = ..., - skipna: bool = True, - *args, - **kwargs, - ) -> S1: ... - def argmin( - self, - axis: AxisIndex | None = ..., - skipna: bool = True, - *args, - **kwargs, - ) -> np.int64: ... - def max( - self, - axis: AxisIndex | None = ..., - skipna: bool = True, - *args, - **kwargs, - ) -> S1: ... - def argmax( - self, - axis: AxisIndex | None = ..., - skipna: bool = True, - *args, - **kwargs, - ) -> np.int64: ... def __rsub__( # type: ignore[override] self, other: DatetimeIndexOpsMixin ) -> TimedeltaIndex: ... diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index d3f5957b6..4011e8b44 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -28,6 +28,7 @@ from pandas.core.series import ( ) from typing_extensions import Self +from pandas._libs.tslibs.offsets import DateOffset from pandas._typing import ( AxesData, DateAndDatetimeLike, @@ -85,8 +86,8 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): def indexer_at_time(self, time, asof: bool = ...): ... def indexer_between_time( self, - start_time, - end_time, + start_time: datetime | str, + end_time: datetime | str, include_start: bool = True, include_end: bool = True, ): ... @@ -96,7 +97,9 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties): def tzinfo(self) -> _tzinfo | None: ... @property def dtype(self) -> np.dtype | DatetimeTZDtype: ... - def shift(self, periods: int = 1, freq=...) -> Self: ... + def shift( + self, periods: int = 1, freq: DateOffset | Timedelta | str | None = None + ) -> Self: ... def date_range( start: str | DateAndDatetimeLike | None = None, diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index f711f0ba9..b1e2477fe 100644 --- a/pandas-stubs/core/indexes/multi.pyi +++ b/pandas-stubs/core/indexes/multi.pyi @@ -19,8 +19,8 @@ from pandas._typing import ( Axes, DropKeep, Dtype, - DtypeArg, HashableT, + IndexLabel, Level, MaskType, NaPosition, @@ -132,27 +132,17 @@ class MultiIndex(Index): def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] self, key: int ) -> tuple: ... - def take( - self, - indices, - axis: int = ..., - allow_fill: bool = True, - fill_value=None, - **kwargs, - ): ... def append(self, other): ... def argsort(self, *args, **kwargs): ... def repeat(self, repeats, axis=...): ... - @final - def where(self, cond, other=None) -> None: ... - def drop(self, codes, level=None, errors: str = "raise") -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + def drop(self, codes, level: Level | None = None, errors: str = "raise") -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] def swaplevel(self, i: int = -2, j: int = -1): ... def reorder_levels(self, order): ... def sortlevel( self, level: Level | Sequence[Level] = 0, ascending: bool = True, - sort_remaining: bool = ..., + sort_remaining: bool = True, na_position: NaPosition = "first", ): ... @final @@ -162,20 +152,15 @@ class MultiIndex(Index): def get_slice_bound( self, label: Hashable | Sequence[Hashable], side: str ) -> int: ... - def get_loc_level(self, key, level=..., drop_level: bool = True): ... + def get_loc_level( + self, key, level: Level | list[Level] | None = None, drop_level: bool = True + ): ... def get_locs(self, seq): ... - def truncate(self, before=None, after=None): ... + def truncate( + self, before: IndexLabel | None = None, after: IndexLabel | None = None + ): ... def equals(self, other) -> bool: ... def equal_levels(self, other): ... - @final - def union(self, other, sort=None): ... # pyrefly: ignore - @final - def intersection( # pyright: ignore[reportIncompatibleMethodOverride] - self, other: list | Self, sort: bool | None = False - ): ... - @final - def difference(self, other, sort=None): ... - def astype(self, dtype: DtypeArg, copy: bool = True) -> Self: ... def insert(self, loc, item): ... def delete(self, loc): ... def isin(self, values, level=...) -> np_ndarray_bool: ... diff --git a/pandas-stubs/core/indexes/period.pyi b/pandas-stubs/core/indexes/period.pyi index 3331ab075..2f3c8df66 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -57,7 +57,6 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): @final def __array_wrap__(self, result, context=...): ... def asof_locs(self, where, mask): ... - def astype(self, dtype, copy: bool = True): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @property def is_full(self) -> bool: ... @@ -77,9 +76,6 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): return_indexers: bool = ..., sort: bool = ..., ): ... - @final - def difference(self, other, sort=None): ... - def memory_usage(self, deep: bool = False): ... @property def freqstr(self) -> str: ... def shift(self, periods: int = 1, freq=...) -> Self: ... diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 59fceab2a..71e920e10 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -53,7 +53,6 @@ class RangeIndex(Index[int]): @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... def tolist(self): ... - def copy(self, name: Hashable = ..., deep: bool = False, dtype=..., **kwargs): ... def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ... def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ... def argsort(self, *args, **kwargs): ... @@ -79,7 +78,7 @@ class RangeIndex(Index[int]): def any(self) -> bool: ... @final def union( # pyrefly: ignore - self, other: list[HashableT] | Index, sort=None + self, other: list[HashableT] | Index, sort: bool | None = None ) -> Index | Index[int] | RangeIndex: ... @overload # type: ignore[override] def __getitem__( diff --git a/pandas-stubs/core/indexes/timedeltas.pyi b/pandas-stubs/core/indexes/timedeltas.pyi index 3feea4562..4c16f6e5d 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -70,7 +70,6 @@ class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties self, other: dt.timedelta | Sequence[dt.timedelta] ) -> Index[int]: ... def __rfloordiv__(self, other: dt.timedelta | Sequence[dt.timedelta]) -> Index[int]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] - def astype(self, dtype, copy: bool = True): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @property def inferred_type(self) -> str: ... @@ -82,7 +81,7 @@ def timedelta_range( start: TimedeltaConvertibleTypes | None = None, end: TimedeltaConvertibleTypes | None = None, periods: int | None = None, - freq: str | DateOffset | Timedelta | dt.timedelta | None = "D", + freq: str | DateOffset | Timedelta | dt.timedelta | None = None, name: Hashable | None = None, closed: Literal["left", "right"] | None = None, *, diff --git a/pandas-stubs/core/util/hashing.pyi b/pandas-stubs/core/util/hashing.pyi index e116fbb1b..fa59fc2ce 100644 --- a/pandas-stubs/core/util/hashing.pyi +++ b/pandas-stubs/core/util/hashing.pyi @@ -14,12 +14,12 @@ def hash_pandas_object( obj: Index | Series | DataFrame, index: bool = True, encoding: str = "utf8", - hash_key: str | None = ..., + hash_key: str | None = "0123456789123456", categorize: bool = True, ) -> Series: ... def hash_array( vals: ArrayLike, encoding: str = "utf8", - hash_key: str = ..., + hash_key: str = "0123456789123456", categorize: bool = True, ) -> npt.NDArray[np.uint64]: ... diff --git a/pandas-stubs/core/window/ewm.pyi b/pandas-stubs/core/window/ewm.pyi index 157ab2f9d..d3f322b56 100644 --- a/pandas-stubs/core/window/ewm.pyi +++ b/pandas-stubs/core/window/ewm.pyi @@ -14,11 +14,6 @@ from pandas._typing import ( ) class ExponentialMovingWindow(BaseWindow[NDFrameT]): - def online( - self, - engine: WindowingEngine = "numba", - engine_kwargs: WindowingEngineKwargs = None, - ) -> OnlineExponentialMovingWindow[NDFrameT]: ... def mean( self, numeric_only: bool = False, @@ -35,14 +30,14 @@ class ExponentialMovingWindow(BaseWindow[NDFrameT]): def var(self, bias: bool = False, numeric_only: bool = False) -> NDFrameT: ... def cov( self, - other: DataFrame | Series | None = ..., + other: DataFrame | Series | None = None, pairwise: bool | None = None, bias: bool = False, numeric_only: bool = False, ) -> NDFrameT: ... def corr( self, - other: DataFrame | Series | None = ..., + other: DataFrame | Series | None = None, pairwise: bool | None = None, numeric_only: bool = False, ) -> NDFrameT: ... @@ -57,13 +52,13 @@ class OnlineExponentialMovingWindow(ExponentialMovingWindow[NDFrameT]): def std(self, bias: bool = False, *args, **kwargs): ... # pyrefly: ignore def corr( self, - other: DataFrame | Series | None = ..., + other: DataFrame | Series | None = None, pairwise: bool | None = None, numeric_only: bool = False, ): ... def cov( self, - other: DataFrame | Series | None = ..., + other: DataFrame | Series | None = None, pairwise: bool | None = None, bias: bool = False, numeric_only: bool = False, diff --git a/pandas-stubs/io/clipboards.pyi b/pandas-stubs/io/clipboards.pyi index 28dcb2367..ddb78d03a 100644 --- a/pandas-stubs/io/clipboards.pyi +++ b/pandas-stubs/io/clipboards.pyi @@ -203,6 +203,3 @@ def read_clipboard( float_precision: Literal["high", "legacy", "round_trip"] | None = ..., storage_options: StorageOptions | None = ..., ) -> DataFrame: ... -def to_clipboard( - obj, excel: bool = True, sep: str | None = None, **kwargs: Any -) -> None: ... From fd5e503335ab09442926b84545f717029dcd943a Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 10:53:49 -0400 Subject: [PATCH 11/17] address more comments --- pandas-stubs/core/series.pyi | 58 +++++++-------- pandas-stubs/io/formats/style.pyi | 90 ++++++++++++------------ pandas-stubs/io/formats/style_render.pyi | 26 +++---- pandas-stubs/io/pickle.pyi | 8 --- pandas-stubs/io/pytables.pyi | 33 +++++---- pandas-stubs/io/stata.pyi | 12 ---- pandas-stubs/util/_doctools.pyi | 8 --- pandas-stubs/util/_tester.pyi | 1 - 8 files changed, 103 insertions(+), 133 deletions(-) delete mode 100644 pandas-stubs/util/_doctools.pyi delete mode 100644 pandas-stubs/util/_tester.pyi diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 70d989b0e..df5a0d6db 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -774,14 +774,14 @@ class Series(IndexOpsMixin[S1], NDFrame): def duplicated(self, keep: DropKeep = "first") -> Series[_bool]: ... def idxmax( self, - axis: AxisIndex = ..., + axis: AxisIndex = 0, skipna: _bool = True, *args: Any, **kwargs: Any, ) -> int | _str: ... def idxmin( self, - axis: AxisIndex = ..., + axis: AxisIndex = 0, skipna: _bool = True, *args: Any, **kwargs: Any, @@ -806,7 +806,7 @@ class Series(IndexOpsMixin[S1], NDFrame): min_periods: int = ..., ) -> float: ... def cov( - self, other: Series[S1], min_periods: int | None = ..., ddof: int = 1 + self, other: Series[S1], min_periods: int | None = None, ddof: int = 1 ) -> float: ... @overload def diff(self: Series[_bool], periods: int = ...) -> Series[type[object]]: ... # type: ignore[overload-overlap] @@ -932,9 +932,10 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def argsort( self, - axis: AxisIndex = ..., + axis: AxisIndex = 0, kind: SortKind = "quicksort", - order: None = ..., + order: None = None, + stable: None = None, ) -> Series[int]: ... def nlargest( self, n: int = 5, keep: NsmallestNlargestKeep = "first" @@ -943,13 +944,13 @@ class Series(IndexOpsMixin[S1], NDFrame): self, n: int = 5, keep: NsmallestNlargestKeep = "first" ) -> Series[S1]: ... def swaplevel( - self, i: Level = ..., j: Level = ..., copy: _bool = True + self, i: Level = -2, j: Level = -1, copy: _bool = True ) -> Series[S1]: ... def reorder_levels(self, order: list) -> Series[S1]: ... def explode(self) -> Series[S1]: ... def unstack( self, - level: IndexLabel = ..., + level: IndexLabel = -1, fill_value: int | _str | dict | None = None, sort: _bool = True, ) -> DataFrame: ... @@ -1043,10 +1044,10 @@ class Series(IndexOpsMixin[S1], NDFrame): self, other: DataFrame | Series, join: JoinHow = "outer", - axis: Axis | None = None, + axis: Axis | None = 0, level: Level | None = None, copy: _bool = True, - fill_value: Scalar | NAType | None = ..., + fill_value: Scalar | NAType | None = None, ) -> tuple[Series, Series]: ... @overload def rename( @@ -1096,10 +1097,10 @@ class Series(IndexOpsMixin[S1], NDFrame): def reindex_like( self, other: Series[S1], - method: FillnaOptions | Literal["nearest"] | None = ..., + method: FillnaOptions | Literal["nearest"] | None = None, copy: _bool = True, limit: int | None = None, - tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., + tolerance: Scalar | AnyArrayLike | Sequence[Scalar] | None = None, ) -> Self: ... @overload def fillna( @@ -1184,7 +1185,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def to_timestamp( self, freq=..., - how: ToTimestampHow = ..., + how: ToTimestampHow = "start", copy: _bool = True, ) -> Series[S1]: ... def to_period(self, freq: _str | None = None, copy: _bool = True) -> DataFrame: ... @@ -1238,19 +1239,19 @@ class Series(IndexOpsMixin[S1], NDFrame): def add_suffix(self, suffix: _str, axis: AxisIndex | None = None) -> Series[S1]: ... def reindex( self, - index: Axes | None = ..., - method: ReindexMethod | None = ..., + index: Axes | None = None, + method: ReindexMethod | None = None, copy: bool = True, - level: int | _str = ..., - fill_value: Scalar | None = ..., + level: int | _str | None = None, + fill_value: Scalar | None = None, limit: int | None = None, - tolerance: float | None = ..., + tolerance: float | None = None, ) -> Series[S1]: ... def filter( self, - items: _ListLike | None = ..., - like: _str | None = ..., - regex: _str | None = ..., + items: _ListLike | None = None, + like: _str | None = None, + regex: _str | None = None, axis: AxisIndex | None = None, ) -> Series[S1]: ... @final @@ -1260,11 +1261,11 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def sample( self, - n: int | None = ..., - frac: float | None = ..., + n: int | None = None, + frac: float | None = None, replace: _bool = False, - weights: _str | _ListLike | np.ndarray | None = ..., - random_state: RandomState | None = ..., + weights: _str | _ListLike | np.ndarray | None = None, + random_state: RandomState | None = None, axis: AxisIndex | None = None, ignore_index: _bool = False, ) -> Series[S1]: ... @@ -1441,17 +1442,17 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def asfreq( self, - freq, + freq: DateOffset | _str, method: FillnaOptions | None = None, - how: Literal["start", "end"] | None = ..., + how: Literal["start", "end"] | None = None, normalize: _bool = False, - fill_value: Scalar | None = ..., + fill_value: Scalar | None = None, ) -> Series[S1]: ... @final def at_time( self, time: _str | time, - asof: _bool = ..., + asof: _bool = False, axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final @@ -1459,6 +1460,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, start_time: _str | time, end_time: _str | time, + inclusive: IntervalClosedType = "both", axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index 81fb8f935..6da2bc13a 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -101,20 +101,20 @@ class Styler(StylerRenderer): excel_writer: FilePath | WriteExcelBuffer | ExcelWriter, sheet_name: str = "Sheet1", na_rep: str = "", - float_format: str | None = ..., - columns: list[HashableT1] | None = ..., + float_format: str | None = None, + columns: list[HashableT1] | None = None, header: list[HashableT2] | bool = True, index: bool = True, - index_label: IndexLabel | None = ..., + index_label: IndexLabel | None = None, startrow: int = 0, startcol: int = 0, - engine: Literal["openpyxl", "xlsxwriter"] | None = ..., + engine: Literal["openpyxl", "xlsxwriter"] | None = None, merge_cells: ExcelWriterMergeCells = True, - encoding: str | None = ..., + encoding: str | None = None, inf_rep: str = "inf", - verbose: bool = ..., - freeze_panes: tuple[int, int] | None = ..., - storage_options: StorageOptions | None = ..., + verbose: bool = True, + freeze_panes: tuple[int, int] | None = None, + storage_options: StorageOptions | None = None, ) -> None: ... @overload def to_latex( @@ -264,15 +264,15 @@ class Styler(StylerRenderer): def set_sticky( self, axis: Axis = 0, - pixel_size: int | None = ..., - levels: Level | list[Level] | None = ..., + pixel_size: int | None = None, + levels: Level | list[Level] | None = None, ) -> Styler: ... def set_table_styles( self, - table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = ..., + table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = None, axis: Axis = 0, overwrite: bool = True, - css_class_names: dict[str, str] | None = ..., + css_class_names: dict[str, str] | None = None, ) -> Styler: ... def hide( self, @@ -283,14 +283,14 @@ class Styler(StylerRenderer): ) -> Styler: ... def background_gradient( self, - cmap: str | Colormap = ..., - low: float = ..., - high: float = ..., + cmap: str | Colormap = "PuBu", + low: float = 0, + high: float = 0, axis: Axis | None = 0, - subset: Subset | None = ..., - text_color_threshold: float = ..., - vmin: float | None = ..., - vmax: float | None = ..., + subset: Subset | None = None, + text_color_threshold: float = 0.408, + vmin: float | None = None, + vmax: float | None = None, gmap: ( Sequence[float] | Sequence[Sequence[float]] @@ -298,19 +298,17 @@ class Styler(StylerRenderer): | DataFrame | Series | None - ) = ..., + ) = None, ) -> Styler: ... def text_gradient( self, - cmap: str | Colormap = ..., - low: float = ..., - high: float = ..., + cmap: str | Colormap = "PuBu", + low: float = 0, + high: float = 0, axis: Axis | None = 0, - subset: Subset | None = ..., - # In docs but not in function declaration - # text_color_threshold: float - vmin: float | None = ..., - vmax: float | None = ..., + subset: Subset | None = None, + vmin: float | None = None, + vmax: float | None = None, gmap: ( Sequence[float] | Sequence[Sequence[float]] @@ -318,68 +316,68 @@ class Styler(StylerRenderer): | DataFrame | Series | None - ) = ..., + ) = None, ) -> Styler: ... def set_properties( self, subset: Subset | None = ..., **kwargs: str | int ) -> Styler: ... def bar( self, - subset: Subset | None = ..., + subset: Subset | None = None, axis: Axis | None = 0, *, - color: str | list[str] | tuple[str, str] | None = ..., - cmap: str | Colormap | None = ..., - width: float = ..., - height: float = ..., + color: str | list[str] | tuple[str, str] | None = None, + cmap: str | Colormap | None = None, + width: float = 100, + height: float = 100, align: ( Literal["left", "right", "zero", "mid", "mean"] | float | Callable[[Series | npt.NDArray | DataFrame], float] - ) = ..., - vmin: float | None = ..., - vmax: float | None = ..., - props: str = ..., + ) = "mid", + vmin: float | None = None, + vmax: float | None = None, + props: str = "width: 10em;", ) -> Styler: ... def highlight_null( self, color: str | None = "red", - subset: Subset | None = ..., + subset: Subset | None = None, props: str | None = None, ) -> Styler: ... def highlight_max( self, - subset: Subset | None = ..., + subset: Subset | None = None, color: str = "yellow", axis: Axis | None = 0, props: str | None = None, ) -> Styler: ... def highlight_min( self, - subset: Subset | None = ..., + subset: Subset | None = None, color: str = "yellow", axis: Axis | None = 0, props: str | None = None, ) -> Styler: ... def highlight_between( self, - subset: Subset | None = ..., + subset: Subset | None = None, color: str = "yellow", axis: Axis | None = 0, left: Scalar | list[Scalar] | None = None, right: Scalar | list[Scalar] | None = None, - inclusive: IntervalClosedType = ..., + inclusive: IntervalClosedType = "both", props: str | None = None, ) -> Styler: ... def highlight_quantile( self, - subset: Subset | None = ..., + subset: Subset | None = None, color: str = "yellow", axis: Axis | None = 0, q_left: float = 0, q_right: float = 1, - interpolation: QuantileInterpolation = ..., - inclusive: IntervalClosedType = ..., + interpolation: QuantileInterpolation = "linear", + inclusive: IntervalClosedType = "both", props: str | None = None, ) -> Styler: ... @classmethod diff --git a/pandas-stubs/io/formats/style_render.pyi b/pandas-stubs/io/formats/style_render.pyi index 2dcc96629..04c268010 100644 --- a/pandas-stubs/io/formats/style_render.pyi +++ b/pandas-stubs/io/formats/style_render.pyi @@ -58,26 +58,26 @@ class StylerRenderer: template_latex: Template def format( self, - formatter: ExtFormatter | None = ..., - subset: Subset | None = ..., - na_rep: str | None = ..., - precision: int | None = ..., + formatter: ExtFormatter | None = None, + subset: Subset | None = None, + na_rep: str | None = None, + precision: int | None = None, decimal: str = ".", thousands: str | None = None, - escape: str | None = ..., - hyperlinks: Literal["html", "latex"] | None = ..., + escape: str | None = None, + hyperlinks: Literal["html", "latex"] | None = None, ) -> Self: ... def format_index( self, - formatter: ExtFormatter | None = ..., - axis: Axis = ..., - level: Level | list[Level] | None = ..., - na_rep: str | None = ..., - precision: int | None = ..., + formatter: ExtFormatter | None = None, + axis: Axis = 0, + level: Level | list[Level] | None = None, + na_rep: str | None = None, + precision: int | None = None, decimal: str = ".", thousands: str | None = None, - escape: str | None = ..., - hyperlinks: Literal["html", "latex"] | None = ..., + escape: str | None = None, + hyperlinks: Literal["html", "latex"] | None = None, ) -> Self: ... def relabel_index( self, diff --git a/pandas-stubs/io/pickle.pyi b/pandas-stubs/io/pickle.pyi index 4b0734904..1265a5406 100644 --- a/pandas-stubs/io/pickle.pyi +++ b/pandas-stubs/io/pickle.pyi @@ -5,16 +5,8 @@ from pandas._typing import ( FilePath, ReadPickleBuffer, StorageOptions, - WriteBuffer, ) -def to_pickle( - obj: object, - filepath_or_buffer: FilePath | WriteBuffer[bytes], - compression: CompressionOptions = "infer", - protocol: int = ..., - storage_options: StorageOptions = None, -) -> None: ... def read_pickle( filepath_or_buffer: FilePath | ReadPickleBuffer, compression: CompressionOptions = "infer", diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 983402c8c..28f0f8575 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -124,7 +124,6 @@ class HDFStore: ) -> None: ... def keys(self, include="pandas") -> list[str]: ... def __iter__(self) -> Iterator[str]: ... - def open(self, mode: Literal["a", "w", "r", "r+"] = "a", **kwargs) -> None: ... def close(self) -> None: ... @property def is_open(self) -> bool: ... @@ -171,13 +170,13 @@ class HDFStore: self, key: str, value: NDFrame, - format: Literal["t", "table", "f", "fixed"] = "fixed", + format: Literal["t", "table", "f", "fixed"] | None = None, index: bool = True, append: bool = False, - complib: HDFCompLib | None = ..., - complevel: int | None = ..., - min_itemsize: int | dict[HashableT1, int] | None = ..., - nan_rep: str | None = ..., + complib: HDFCompLib | None = None, + complevel: int | None = None, + min_itemsize: int | dict[HashableT1, int] | None = None, + nan_rep: str | None = None, data_columns: Literal[True] | list[HashableT2] | None = None, encoding: str | None = None, errors: Literal[ @@ -188,7 +187,7 @@ class HDFStore: "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., + ] = "strict", track_times: bool = True, dropna: bool = False, ) -> None: ... @@ -196,17 +195,17 @@ class HDFStore: self, key: str, value: NDFrame, - format: Literal["t", "table", "f", "fixed"] = ..., - axes: int | None = ..., + format: Literal["t", "table", "f", "fixed"] | None = None, + axes: int | None = None, index: bool = True, append: bool = True, - complib: HDFCompLib | None = ..., - complevel: int | None = ..., - columns: list[HashableT1] | None = ..., - min_itemsize: int | dict[HashableT2, int] | None = ..., - nan_rep: str | None = ..., - chunksize: int | None = ..., - expectedrows: int | None = ..., + complib: HDFCompLib | None = None, + complevel: int | None = None, + columns: list[HashableT1] | None = None, + min_itemsize: int | dict[HashableT2, int] | None = None, + nan_rep: str | None = None, + chunksize: int | None = None, + expectedrows: int | None = None, dropna: bool | None = False, data_columns: Literal[True] | list[HashableT3] | None = None, encoding: str | None = None, @@ -218,7 +217,7 @@ class HDFStore: "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., + ] = "strict", ) -> None: ... def groups(self) -> list: ... def walk( diff --git a/pandas-stubs/io/stata.pyi b/pandas-stubs/io/stata.pyi index e34d19fa5..9874a0452 100644 --- a/pandas-stubs/io/stata.pyi +++ b/pandas-stubs/io/stata.pyi @@ -101,18 +101,6 @@ class StataReader(StataParser, abc.Iterator): traceback: TracebackType | None, ) -> None: ... def __next__(self) -> DataFrame: ... - def get_chunk(self, size: int | None = None) -> DataFrame: ... - def read( - self, - nrows: int | None = ..., - convert_dates: bool | None = True, - convert_categoricals: bool | None = True, - index_col: str | None = ..., - convert_missing: bool | None = False, - preserve_dtypes: bool | None = True, - columns: list[str] | None = ..., - order_categoricals: bool | None = True, - ): ... @property def data_label(self) -> str: ... def variable_labels(self) -> dict[str, str]: ... diff --git a/pandas-stubs/util/_doctools.pyi b/pandas-stubs/util/_doctools.pyi deleted file mode 100644 index 39d4e007c..000000000 --- a/pandas-stubs/util/_doctools.pyi +++ /dev/null @@ -1,8 +0,0 @@ -class TablePlotter: - cell_width = ... - cell_height = ... - font_size = ... - def __init__( - self, cell_width: float = ..., cell_height: float = ..., font_size: float = ... - ) -> None: ... - def plot(self, left, right, labels=..., vertical: bool = True): ... diff --git a/pandas-stubs/util/_tester.pyi b/pandas-stubs/util/_tester.pyi deleted file mode 100644 index 0dd6e1278..000000000 --- a/pandas-stubs/util/_tester.pyi +++ /dev/null @@ -1 +0,0 @@ -def test(extra_args: list[str] | None = None, run_doctests: bool = False) -> None: ... From fede4454eb2e7e93d47a5b006b5eb7767e43529e Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 15:52:12 -0400 Subject: [PATCH 12/17] fix broken tests --- pandas-stubs/_libs/tslibs/timestamps.pyi | 10 +--------- pandas-stubs/io/api.pyi | 1 - tests/test_indexes.py | 6 ++---- tests/test_io.py | 5 ----- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 55dcdfefc..03c89082d 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -160,15 +160,7 @@ class Timestamp(datetime, SupportsIndex): def isoformat( self, sep: str = "T", - timespec: Literal[ - "auto", - "hours", - "minutes", - "seconds", - "milliseconds", - "microseconds", - "nanoseconds", - ] = "auto", + timespec: str = "auto", ) -> str: ... @classmethod def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] diff --git a/pandas-stubs/io/api.pyi b/pandas-stubs/io/api.pyi index fabe45b04..dc41ede2f 100644 --- a/pandas-stubs/io/api.pyi +++ b/pandas-stubs/io/api.pyi @@ -17,7 +17,6 @@ from pandas.io.parsers import ( ) from pandas.io.pickle import ( read_pickle as read_pickle, - to_pickle as to_pickle, ) from pandas.io.pytables import ( HDFStore as HDFStore, diff --git a/tests/test_indexes.py b/tests/test_indexes.py index b713f231d..49ec69736 100644 --- a/tests/test_indexes.py +++ b/tests/test_indexes.py @@ -56,8 +56,6 @@ def test_index_astype() -> None: indc = indi.astype(inds.dtype) check(assert_type(indc, pd.Index), pd.Index) mi = pd.MultiIndex.from_product([["a", "b"], ["c", "d"]], names=["ab", "cd"]) - mia = mi.astype(object) # object is only valid parameter for MultiIndex.astype() - check(assert_type(mia, pd.MultiIndex), pd.MultiIndex) check( assert_type(mi.to_frame(name=[3, 7], allow_duplicates=True), pd.DataFrame), pd.DataFrame, @@ -1346,8 +1344,8 @@ def test_datetime_index_max_min_reductions() -> None: dtidx = pd.DatetimeIndex(["2020-01-01", "2020-01-02"]) check(assert_type(dtidx.argmax(), np.int64), np.int64) check(assert_type(dtidx.argmin(), np.int64), np.int64) - check(assert_type(dtidx.max(), pd.Timestamp), pd.Timestamp) - check(assert_type(dtidx.min(), pd.Timestamp), pd.Timestamp) + check(assert_type(dtidx.max(), Any), pd.Timestamp) + check(assert_type(dtidx.min(), Any), pd.Timestamp) def test_periodindex_shift() -> None: diff --git a/tests/test_io.py b/tests/test_io.py index 0d0d27dbd..48618261e 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -55,7 +55,6 @@ ) from tests import NUMPY20 # See https://github.com/PyTables/PyTables/issues/1172 -from pandas.io.api import to_pickle from pandas.io.parsers import TextFileReader from pandas.io.pytables import ( TableIterator, @@ -125,10 +124,6 @@ def test_pickle(): check(assert_type(DF.to_pickle(path), None), type(None)) check(assert_type(read_pickle(path), Any), DataFrame) - with ensure_clean() as path: - check(assert_type(to_pickle(DF, path), None), type(None)) - check(assert_type(read_pickle(path), Any), DataFrame) - def test_pickle_file_handle(): with ensure_clean() as path: From 70ef6089aef9103165a0a574ee6f8e23b149d21f Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 15:58:07 -0400 Subject: [PATCH 13/17] remove top level to_pickle --- pandas-stubs/__init__.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas-stubs/__init__.pyi b/pandas-stubs/__init__.pyi index aa3984914..62d205812 100644 --- a/pandas-stubs/__init__.pyi +++ b/pandas-stubs/__init__.pyi @@ -119,7 +119,6 @@ from pandas.io.api import ( read_stata as read_stata, read_table as read_table, read_xml as read_xml, - to_pickle as to_pickle, ) from pandas.io.json._normalize import json_normalize as json_normalize from pandas.tseries import offsets as offsets From 1bf85c2239d5228a2fd5e48a95a9fc5a9b8fc9bc Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 17:51:32 -0400 Subject: [PATCH 14/17] restore DateTimeIndex methods --- pandas-stubs/core/indexes/datetimelike.pyi | 14 ++++++++++++++ tests/test_indexes.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index bba51a6f0..34a48317a 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -1,3 +1,4 @@ +import numpy as np from pandas.core.indexes.extension import ExtensionIndex from pandas.core.indexes.timedeltas import TimedeltaIndex from typing_extensions import Self @@ -5,6 +6,7 @@ from typing_extensions import Self from pandas._libs.tslibs import BaseOffset from pandas._typing import ( S1, + AxisIndex, TimeUnit, ) @@ -15,6 +17,18 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]): def freqstr(self) -> str | None: ... @property def is_all_dates(self) -> bool: ... + def min( + self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + ) -> S1: ... + def argmin( + self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + ) -> np.int64: ... + def max( + self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + ) -> S1: ... + def argmax( + self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + ) -> np.int64: ... def __rsub__( # type: ignore[override] self, other: DatetimeIndexOpsMixin ) -> TimedeltaIndex: ... diff --git a/tests/test_indexes.py b/tests/test_indexes.py index 49ec69736..e619151b8 100644 --- a/tests/test_indexes.py +++ b/tests/test_indexes.py @@ -1344,8 +1344,8 @@ def test_datetime_index_max_min_reductions() -> None: dtidx = pd.DatetimeIndex(["2020-01-01", "2020-01-02"]) check(assert_type(dtidx.argmax(), np.int64), np.int64) check(assert_type(dtidx.argmin(), np.int64), np.int64) - check(assert_type(dtidx.max(), Any), pd.Timestamp) - check(assert_type(dtidx.min(), Any), pd.Timestamp) + check(assert_type(dtidx.max(), pd.Timestamp), pd.Timestamp) + check(assert_type(dtidx.min(), pd.Timestamp), pd.Timestamp) def test_periodindex_shift() -> None: From 61896fd7fd7d937f1b75b22424bd918dcb47ae10 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Wed, 30 Jul 2025 20:48:53 -0400 Subject: [PATCH 15/17] change isoformat and add type ignore --- pandas-stubs/_libs/tslibs/timestamps.pyi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/_libs/tslibs/timestamps.pyi b/pandas-stubs/_libs/tslibs/timestamps.pyi index 03c89082d..11302a12c 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -157,10 +157,18 @@ class Timestamp(datetime, SupportsIndex): ) -> Timestamp: ... def astimezone(self, tz: _tzinfo | None = ...) -> Self: ... def ctime(self) -> str: ... - def isoformat( + def isoformat( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] self, sep: str = "T", - timespec: str = "auto", + timespec: Literal[ + "auto", + "hours", + "minutes", + "seconds", + "milliseconds", + "microseconds", + "nanoseconds", + ] = "auto", ) -> str: ... @classmethod def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] From ac20a93ba948d16f68e9085c9c8fc27877dcd26d Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Fri, 1 Aug 2025 09:32:38 -0400 Subject: [PATCH 16/17] address comments --- pandas-stubs/_testing/__init__.pyi | 15 ++++++----- pandas-stubs/core/frame.pyi | 31 ++++++---------------- pandas-stubs/core/indexes/datetimelike.pyi | 8 +++--- pandas-stubs/core/series.pyi | 8 +++--- 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index 18b7aa959..9ad256f4b 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -5,7 +5,6 @@ from collections.abc import ( ) from contextlib import contextmanager from typing import ( - Any, Literal, overload, ) @@ -81,10 +80,16 @@ def assert_period_array_equal( left: PeriodArray, right: PeriodArray, obj: str = "PeriodArray" ) -> None: ... def assert_datetime_array_equal( - left: DatetimeArray, right: DatetimeArray, check_freq: bool = True + left: DatetimeArray, + right: DatetimeArray, + obj: str = "DatetimeArray", + check_freq: bool = True, ) -> None: ... def assert_timedelta_array_equal( - left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = True + left: TimedeltaArray, + right: TimedeltaArray, + obj: str = "TimedeltaArray", + check_freq: bool = True, ) -> None: ... def assert_numpy_array_equal( left, @@ -184,6 +189,4 @@ def assert_produces_warning( match: str | None = None, ) -> Generator[list[warnings.WarningMessage], None, None]: ... @contextmanager -def ensure_clean( - filename: str | None = None, return_filelike: bool = False, **kwargs: Any -) -> Generator[str, None, None]: ... +def ensure_clean(filename: str | None = None) -> Generator[str, None, None]: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 65c205f4e..d973a9d04 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -470,28 +470,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): into: type[dict] = ..., index: bool = ..., ) -> dict[Hashable, Any]: ... - def to_gbq( - self, - destination_table: str, - *, - project_id: str | None = ..., - chunksize: int | None = ..., - reauth: bool = ..., - if_exists: Literal["fail", "replace", "append"] = ..., - auth_local_webserver: bool = ..., - table_schema: list[dict[str, str]] | None = ..., - location: str | None = ..., - progress_bar: bool = ..., - # Google type, not available - credentials: Any = ..., - ) -> None: ... @classmethod def from_records( cls, data, index=..., - exclude: Sequence[str] | None = None, - columns: Sequence[str] | None = None, + exclude: SequenceNotStr[str] | None = None, + columns: SequenceNotStr[str] | None = None, coerce_float: bool = False, nrows: int | None = None, ) -> Self: ... @@ -1596,11 +1581,11 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): other: DataFrame | Series, axis: Axis | None = 0, drop: _bool = False, - method: Literal["pearson", "kendall", "spearman"] = ..., + method: Literal["pearson", "kendall", "spearman"] = "pearson", numeric_only: _bool = False, ) -> Series: ... - def count(self, axis: Axis = 0, numeric_only: _bool = ...) -> Series[int]: ... - def nunique(self, axis: Axis = 0, dropna: bool = ...) -> Series: ... + def count(self, axis: Axis = 0, numeric_only: _bool = False) -> Series[int]: ... + def nunique(self, axis: Axis = 0, dropna: bool = True) -> Series[int]: ... def idxmax( self, axis: Axis = 0, @@ -1681,7 +1666,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): grid: _bool = True, figsize: tuple[float, float] | None = None, layout: tuple[int, int] | None = None, - return_type: Literal["axes", "dict", "both"] | None = "axes", + return_type: Literal["axes", "dict", "both"] | None = None, backend: _str | None = None, **kwargs: Any, ): ... @@ -1805,7 +1790,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, start_time: _str | dt.time, end_time: _str | dt.time, - inclusive: IntervalClosedType = ..., + inclusive: IntervalClosedType = "both", axis: Axis | None = 0, ) -> Self: ... @overload @@ -2377,7 +2362,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): ) -> Self: ... def sum( self, - axis: Axis = ..., + axis: Axis = 0, skipna: _bool | None = True, numeric_only: _bool = False, min_count: int = 0, diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index 34a48317a..1e14614c7 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -18,16 +18,16 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1]): @property def is_all_dates(self) -> bool: ... def min( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs ) -> S1: ... def argmin( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs ) -> np.int64: ... def max( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs ) -> S1: ... def argmax( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs ) -> np.int64: ... def __rsub__( # type: ignore[override] self, other: DatetimeIndexOpsMixin diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index c935b199b..5d51de1fc 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1145,7 +1145,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, periods: int | Sequence[int] = ..., freq: DateOffset | timedelta | _str | None = None, - axis: Axis | None = None, + axis: Axis = 0, fill_value: Scalar | NAType | None = ..., ) -> Series: ... def info( @@ -1984,9 +1984,9 @@ class Series(IndexOpsMixin[S1], NDFrame): min_periods: int = 0, adjust: _bool = True, ignore_na: _bool = False, - axis: Axes = ..., - times: np.ndarray | Series | None = ..., - method: CalculationMethod = ..., + axis: Axis = 0, + times: np.ndarray | Series | None = None, + method: CalculationMethod = "single", ) -> ExponentialMovingWindow[Series]: ... @final def expanding( From 770cf50a5e136646e62640fd542bbb1ad0b27052 Mon Sep 17 00:00:00 2001 From: yangdanny97 Date: Fri, 1 Aug 2025 23:05:33 -0400 Subject: [PATCH 17/17] fix freq param in DataFrame.shift and Series.shift --- pandas-stubs/core/frame.pyi | 2 +- pandas-stubs/core/series.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index d973a9d04..b34c10d99 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -883,7 +883,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def shift( self, periods: int | Sequence[int] = ..., - freq: DateOffset | dt.timedelta | _str | None = ..., + freq: BaseOffset | dt.timedelta | _str | None = ..., axis: Axis | None = None, fill_value: Scalar | NAType | None = ..., ) -> Self: ... diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 5d51de1fc..7d2679552 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1144,7 +1144,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def shift( self, periods: int | Sequence[int] = ..., - freq: DateOffset | timedelta | _str | None = None, + freq: BaseOffset | timedelta | _str | None = None, axis: Axis = 0, fill_value: Scalar | NAType | None = ..., ) -> Series: ...