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 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 b52dd542e..211066a22 100644 --- a/pandas-stubs/_libs/tslibs/nattype.pyi +++ b/pandas-stubs/_libs/tslibs/nattype.pyi @@ -74,34 +74,34 @@ 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( 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 b986c186a..11302a12c 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" @@ -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 = ..., timespec: str = ...) -> str: ... + def isoformat( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] + 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: ... @@ -276,31 +288,31 @@ 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 = ...) -> 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 @@ -322,6 +334,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 c223c8096..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, ) @@ -36,29 +35,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_dict_equal(left: dict, right: dict, compare_keys: bool = True) -> 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 = ... + 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 = ... + 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,44 +66,50 @@ 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 = ... + left: PeriodArray, right: PeriodArray, obj: str = "PeriodArray" ) -> None: ... def assert_datetime_array_equal( - left: DatetimeArray, right: DatetimeArray, check_freq: bool = ... + left: DatetimeArray, + right: DatetimeArray, + obj: str = "DatetimeArray", + check_freq: bool = True, ) -> None: ... def assert_timedelta_array_equal( - left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = ... + left: TimedeltaArray, + right: TimedeltaArray, + obj: str = "TimedeltaArray", + check_freq: bool = True, ) -> None: ... def assert_numpy_array_equal( left, right, - strict_nan: bool = ..., - check_dtype: bool | Literal["equiv"] = ..., - err_msg: str | None = ..., - check_same: Literal["copy", "same"] | None = ..., - obj: str = ..., - index_values: Index | np.ndarray | None = ..., + strict_nan: bool = False, + check_dtype: bool | Literal["equiv"] = True, + err_msg: str | None = None, + check_same: Literal["copy", "same"] | None = None, + 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"] = ..., - index_values: Index | np.ndarray | None = ..., - check_exact: bool = ..., - rtol: float = ..., - atol: float = ..., - obj: str = ..., + check_dtype: bool | Literal["equiv"] = True, + index_values: Index | np.ndarray | None = None, + check_exact: bool = False, + rtol: float = 1e-5, + atol: float = 1e-8, + obj: str = "ExtensionArray", ) -> None: ... @overload def assert_series_equal( @@ -151,21 +156,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 +183,10 @@ 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 -) -> Generator[str, None, None]: ... +def ensure_clean(filename: str | None = None) -> Generator[str, None, None]: ... diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index 49f922a1c..803878ba8 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 = ..., - bins: int | None = ..., - dropna: bool = ..., + sort: bool = True, + ascending: bool = False, + normalize: bool = False, + bins: int | None = None, + dropna: bool = True, ) -> Series: ... def take( arr, diff --git a/pandas-stubs/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi index 6a7e2afee..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=..., limit=...): ... + 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 61af02938..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 = ... @@ -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 = False, + rename: bool = False, ) -> Categorical: ... def rename_categories(self, new_categories) -> Categorical: ... def reorder_categories( @@ -86,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 @@ -100,14 +103,14 @@ 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( 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: ... @@ -152,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 8b1c6ac6d..a93f8c54b 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 = "raise", + nonexistent: TimeNonexistent = "raise", ): ... def floor( - self, freq, ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ... + self, + freq, + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... def ceil( - self, freq, ambiguous: TimeAmbiguous = ..., nonexistent: TimeNonexistent = ... + self, + freq, + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ): ... class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): @@ -70,17 +79,17 @@ 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=..., limit=...): ... + def fillna(self, value=..., method=None, limit=None): ... @property def freq(self): ... @freq.setter 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 122f1cd8c..304cc2960 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 = "right", + copy: bool = False, + dtype=None, + ): ... @classmethod def from_arrays( - cls, left, right, closed: str = ..., copy: bool = ..., dtype=... + cls, + left, + right, + closed: str = "right", + copy: bool = False, + dtype=..., ): ... @classmethod - def from_tuples(cls, data, closed: str = ..., copy: bool = ..., dtype=...): ... + def from_tuples( + cls, + data, + closed: str = "right", + copy: bool = False, + dtype=None, + ): ... def __iter__(self): ... def __len__(self) -> int: ... @overload @@ -48,17 +65,17 @@ 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 = ...): ... + 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, @@ -68,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 @@ -84,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 cdde9e028..25f04093d 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 astype(self, dtype, copy: bool = ...): ... - def value_counts(self, dropna: bool = ...): ... + def fillna(self, value=..., method=None, limit=None): ... + 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 e49bd43c9..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: ... @@ -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 = True, + *args, + **kwargs, ) -> np.int64: ... def argmin( - self, axis: AxisIndex | None = ..., skipna: bool = ..., *args, **kwargs + self, + axis: AxisIndex | None = ..., + skipna: bool = True, + *args, + **kwargs, ) -> np.int64: ... def tolist(self) -> list[S1]: ... def to_list(self) -> list[S1]: ... @@ -97,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 @@ -105,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 9e0eef2bf..19df29909 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"] = ..., + parser: Literal["pandas", "python"] = "pandas", engine: Literal["python", "numexpr"] | None = ..., - 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 = ..., - target: object | None = ..., - inplace: bool = ..., + 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 673e6ea06..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 = ..., - copy: bool = ..., + dtype: str | np.dtype | ExtensionDtype | None = None, + copy: bool = True, ) -> ExtensionArray: ... diff --git a/pandas-stubs/core/dtypes/concat.pyi b/pandas-stubs/core/dtypes/concat.pyi index a253220a7..98a622c8b 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 = False, + ignore_order: bool = False, ) -> Categorical: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 80521be87..72ed27c9b 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -403,7 +403,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 @@ -470,34 +470,25 @@ 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=..., columns=..., coerce_float=..., nrows=... + cls, + data, + index=..., + exclude: SequenceNotStr[str] | None = None, + columns: SequenceNotStr[str] | None = None, + coerce_float: bool = False, + nrows: int | None = None, ) -> Self: ... def to_records( self, - index: _bool = ..., + index: _bool = True, 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( @@ -722,7 +713,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 +798,10 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def align( self, other: NDFrameT, - join: AlignJoin = ..., - axis: Axis | None = ..., - level: Level | None = ..., - copy: _bool = ..., + join: AlignJoin = "outer", + axis: Axis | None = None, + level: Level | None = None, + copy: _bool = True, fill_value: Scalar | NAType | None = ..., ) -> tuple[Self, NDFrameT]: ... def reindex( @@ -821,10 +812,10 @@ 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 = ..., + limit: int | None = None, tolerance: float | None = ..., ) -> Self: ... @overload @@ -893,7 +884,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): self, periods: int | Sequence[int] = ..., freq: BaseOffset | dt.timedelta | _str | None = ..., - axis: Axis = ..., + axis: Axis | None = None, fill_value: Scalar | NAType | None = ..., ) -> Self: ... @overload @@ -1001,7 +992,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def duplicated( self, subset: Hashable | Iterable[Hashable] | None = ..., - keep: DropKeep = ..., + keep: DropKeep = "first", ) -> Series: ... @overload def sort_values( @@ -1079,39 +1070,39 @@ 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( self, other: DataFrame, func: Callable, - fill_value: Scalar | None = ..., - overwrite: _bool = ..., + fill_value: Scalar | None = None, + 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 @@ -1317,13 +1308,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): values: _PivotTableValuesTypes = ..., index: _PivotTableIndexTypes = ..., columns: _PivotTableColumnsTypes = ..., - aggfunc=..., - fill_value: Scalar | None = ..., - margins: _bool = ..., - dropna: _bool = ..., - margins_name: _str = ..., - observed: _bool = ..., - sort: _bool = ..., + aggfunc="mean", + fill_value: Scalar | None = None, + margins: _bool = False, + dropna: _bool = True, + margins_name: _str = "All", + observed: _bool = True, + sort: _bool = True, ) -> Self: ... @overload def stack( @@ -1341,24 +1332,24 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): future_stack: Literal[False] = ..., ) -> 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 = ..., - fill_value: Scalar | None = ..., - sort: _bool = ..., + level: IndexLabel = -1, + fill_value: Scalar | None = None, + 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 = ..., - value_name: Scalar = ..., + var_name: Scalar | None = None, + 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, @@ -1390,7 +1381,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def transform( self, func: AggFuncTypeFrame, - axis: Axis = ..., + axis: Axis = 0, *args: Any, **kwargs: Any, ) -> Self: ... @@ -1543,66 +1534,75 @@ 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, 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 = ..., - validate: MergeValidate | None = ..., + copy: _bool = True, + indicator: _bool | _str = False, + 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 = ..., + numeric_only: _bool = False, ) -> Self: ... def cov( - self, min_periods: int | None = ..., ddof: int = ..., numeric_only: _bool = ... + self, + min_periods: int | None = None, + ddof: int = 1, + numeric_only: _bool = False, ) -> Self: ... def corrwith( self, other: DataFrame | Series, - axis: Axis | None = ..., - drop: _bool = ..., - method: Literal["pearson", "kendall", "spearman"] = ..., - numeric_only: _bool = ..., + axis: Axis | None = 0, + drop: _bool = False, + method: Literal["pearson", "kendall", "spearman"] = "pearson", + numeric_only: _bool = False, ) -> Series: ... - def count(self, axis: Axis = ..., numeric_only: _bool = ...) -> Series[int]: ... - def nunique(self, axis: Axis = ..., 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 = ..., skipna: _bool = ..., numeric_only: _bool = ... + self, + axis: Axis = 0, + skipna: _bool = True, + numeric_only: _bool = False, ) -> Series: ... def idxmin( - self, axis: Axis = ..., skipna: _bool = ..., numeric_only: _bool = ... + self, + 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( @@ -1626,45 +1626,48 @@ 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 = ... + self, + freq: _str | None = None, + axis: Axis = 0, + copy: _bool = True, ) -> Self: ... def isin(self, values: Iterable | Series | DataFrame | dict) -> Self: ... @property def plot(self) -> PlotAccessor: ... def hist( self, - 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 = ..., - sharex: _bool = ..., - sharey: _bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - bins: int | list = ..., - backend: _str | 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 = False, + sharey: _bool = False, + 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 = ..., - rot: float = ..., - grid: _bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - return_type: Literal["axes", "dict", "both"] | None = ..., - backend: _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 = None, + layout: tuple[int, int] | None = None, + return_type: Literal["axes", "dict", "both"] | None = None, + backend: _str | None = None, **kwargs: Any, ): ... sparse = ... @@ -1715,9 +1718,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def add( self, other: num | ListLike | DataFrame, - axis: Axis | None = ..., - level: Level | None = ..., - fill_value: float | None = ..., + axis: Axis | None = "columns", + level: Level | None = None, + fill_value: float | None = None, ) -> Self: ... @final def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Self: ... @@ -1758,37 +1761,37 @@ 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 = ..., + 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 = ..., + asof: _bool = False, + axis: Axis | None = 0, ) -> Self: ... @final def between_time( self, start_time: _str | dt.time, end_time: _str | dt.time, - inclusive: IntervalClosedType = ..., - axis: Axis | None = ..., + inclusive: IntervalClosedType = "both", + axis: Axis | None = 0, ) -> Self: ... @overload def bfill( @@ -1879,18 +1882,34 @@ 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 = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = None, + skipna: _bool = True, + *args: Any, + **kwargs: Any, ) -> Self: ... def cummin( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = None, + skipna: _bool = True, + *args: Any, + **kwargs: Any, ) -> Self: ... def cumprod( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = None, + skipna: _bool = True, + *args: Any, + **kwargs: Any, ) -> Self: ... def cumsum( - self, axis: Axis | None = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: Axis | None = None, + skipna: _bool = True, + *args: Any, + **kwargs: Any, ) -> Self: ... @final def describe( @@ -1904,18 +1923,18 @@ 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: ... - 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 @@ -1925,17 +1944,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( @@ -1960,7 +1979,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: ... @@ -1971,11 +1990,9 @@ 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 - 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 @@ -1984,9 +2001,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, copy: _bool | None = ...) -> Self: ... @overload @@ -2017,23 +2034,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, @@ -2069,29 +2086,29 @@ 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 = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def min( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def mod( @@ -2099,28 +2116,28 @@ 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: ... + 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 = None, freq: DateOffset | dt.timedelta | _str | None = ..., fill_value: Scalar | NAType | None = ..., ) -> Self: ... @@ -2130,55 +2147,55 @@ 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, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Series: ... def product( self, axis: Axis | None = ..., - skipna: _bool = ..., - numeric_only: _bool = ..., - min_count: int = ..., + skipna: _bool = True, + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Series: ... def radd( self, other, - axis: Axis = ..., - level: Level | None = ..., - fill_value: float | None = ..., + axis: Axis = "columns", + level: Level | None = None, + fill_value: float | None = None, ) -> Self: ... @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, other, axis: Axis = ..., level: Level | None = ..., - fill_value: float | None = ..., + fill_value: float | None = None, ) -> Self: ... @final def reindex_like( self, other: DataFrame, method: FillnaOptions | Literal["nearest"] | None = ..., - copy: _bool = ..., - limit: int | None = ..., + copy: _bool = True, + limit: int | None = None, tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., ) -> Self: ... # Rename axis with `mapper`, `axis`, and `inplace=True` @@ -2226,21 +2243,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( @@ -2275,39 +2292,39 @@ 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 = ..., + axis: Axis = "columns", + level: Level | None = None, + fill_value: float | None = None, ) -> Self: ... @final def sample( self, n: int | None = ..., frac: float | None = ..., - replace: _bool = ..., + replace: _bool = False, weights: _str | ListLike | None = ..., random_state: RandomState | None = ..., - axis: Axis | None = ..., - ignore_index: _bool = ..., + axis: Axis | None = None, + ignore_index: _bool = False, ) -> Self: ... def sem( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... # Not actually positional, but used to handle removal of deprecated @@ -2315,18 +2332,18 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def skew( self, axis: Axis | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + numeric_only: _bool = False, **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 = ..., - skipna: _bool = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... def sub( @@ -2334,27 +2351,27 @@ 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, - axis: Axis = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + axis: Axis = 0, + skipna: _bool | None = True, + 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, @@ -2480,9 +2497,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def truediv( self, other: num | ListLike | DataFrame, - axis: Axis | None = ..., - level: Level | None = ..., - fill_value: float | None = ..., + axis: Axis | None = "columns", + level: Level | None = None, + fill_value: float | None = None, ) -> Self: ... @final def truncate( @@ -2496,26 +2513,26 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def tz_convert( self, tz: TimeZones, - axis: Axis = ..., - level: Level | None = ..., - copy: _bool = ..., + axis: Axis = 0, + level: Level | None = None, + copy: _bool = True, ) -> Self: ... @final def tz_localize( self, tz: TimeZones, - axis: Axis = ..., - level: Level | None = ..., - copy: _bool = ..., - ambiguous: TimeAmbiguous = ..., - nonexistent: TimeNonexistent = ..., + axis: Axis = 0, + level: Level | None = None, + copy: _bool = True, + ambiguous: TimeAmbiguous = "raise", + nonexistent: TimeNonexistent = "raise", ) -> Self: ... def var( self, axis: Axis = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Series: ... @overload @@ -2557,9 +2574,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 664c98dca..ebecca15b 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, ) @@ -106,18 +105,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 @@ -165,9 +164,9 @@ class NDFrame(indexing.IndexingMixin): name: _str, con: str | sqlalchemy.engine.Connectable | sqlite3.Connection, schema: _str | None = ..., - if_exists: Literal["fail", "replace", "append"] = ..., - index: _bool = ..., - index_label: IndexLabel = ..., + if_exists: Literal["fail", "replace", "append"] = "fail", + index: _bool = True, + index_label: IndexLabel = None, chunksize: int | None = ..., dtype: DtypeArg | None = ..., method: ( @@ -183,15 +182,15 @@ class NDFrame(indexing.IndexingMixin): def to_pickle( self, path: FilePath | WriteBuffer[bytes], - compression: CompressionOptions = ..., - protocol: int = ..., + compression: CompressionOptions = "infer", + protocol: int = 5, storage_options: StorageOptions = ..., ) -> None: ... @final def to_clipboard( self, - excel: _bool = ..., - sep: _str | None = ..., + excel: _bool = True, + sep: _str | None = None, *, na_rep: _str = ..., float_format: _str | Callable[[object], _str] | None = ..., @@ -412,27 +411,25 @@ class NDFrame(indexing.IndexingMixin): @final def convert_dtypes( self, - infer_objects: _bool = ..., - convert_string: _bool = ..., - convert_integer: _bool = ..., - convert_boolean: _bool = ..., - convert_floating: _bool = ..., - dtype_backend: DtypeBackend = ..., + infer_objects: _bool = True, + convert_string: _bool = True, + convert_integer: _bool = True, + convert_boolean: _bool = True, + convert_floating: _bool = True, + dtype_backend: DtypeBackend = "numpy_nullable", ) -> Self: ... @final def resample( self, rule: Frequency | dt.timedelta, - axis: Axis | _NoDefaultDoNotUse = ..., - closed: Literal["right", "left"] | None = ..., - label: Literal["right", "left"] | None = ..., - convention: ToTimestampHow = ..., - kind: Literal["period", "timestamp"] | None = ..., - on: Level | None = ..., - level: Level | None = ..., - origin: TimeGrouperOrigin | TimestampConvertibleTypes = ..., - offset: TimedeltaConvertibleTypes | None = ..., - group_keys: _bool = ..., + axis: Axis | _NoDefaultDoNotUse = 0, + closed: Literal["right", "left"] | None = None, + label: Literal["right", "left"] | None = None, + on: Level | None = None, + level: Level | None = None, + origin: TimeGrouperOrigin | TimestampConvertibleTypes = "start_day", + offset: TimedeltaConvertibleTypes | None = None, + 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 2e4864cd3..75430c052 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, @@ -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 = None, + ddof: int | None = 1, ) -> Series: ... @property def is_monotonic_increasing(self) -> Series[bool]: ... @@ -185,17 +188,17 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): def is_monotonic_decreasing(self) -> Series[bool]: ... def hist( self, - 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 = ..., - bins: int | Sequence[int] = ..., - backend: str | None = ..., - legend: bool = ..., + by: IndexLabel | None = None, + ax: PlotAxes | None = None, + 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] = 10, + backend: str | None = None, + legend: bool = False, **kwargs, ) -> Series: ... # Series[Axes] but this is not allowed @property @@ -291,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( @@ -411,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 = ..., - xlabelsize: float | str | None = ..., - xrot: float | None = ..., - ylabelsize: float | str | None = ..., - yrot: float | None = ..., - ax: PlotAxes | None = ..., - sharex: bool = ..., - sharey: bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - bins: int | Sequence[int] = ..., - backend: str | None = ..., - legend: bool = ..., + 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 = False, + sharey: bool = False, + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, + bins: int | Sequence[int] = 10, + backend: str | None = None, + 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 5001037fb..1490e7d17 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 = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + 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,37 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def sum( self, - numeric_only: bool = ..., - min_count: int = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + 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 = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + 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 = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + 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, skipna: bool = True + ) -> NDFrameT: ... @final - def last(self, numeric_only: bool = ..., min_count: int = ...) -> NDFrameT: ... + def last( + self, numeric_only: bool = False, min_count: int = -1, skipna: bool = True + ) -> NDFrameT: ... @final def ohlc(self) -> DataFrame: ... def describe( @@ -211,15 +215,15 @@ class GroupBy(BaseGroupBy[NDFrameT]): def rolling( self, window: int | dt.timedelta | str | BaseOffset | BaseIndexer | None = ..., - min_periods: int | None = ..., - center: bool | None = ..., - win_type: str | None = ..., - axis: Axis = ..., - on: str | Index | None = ..., - closed: IntervalClosedType | None = ..., - method: CalculationMethod = ..., + min_periods: int | None = None, + center: bool | None = False, + win_type: str | None = None, + axis: Axis = 0, + on: str | Index | None = None, + closed: IntervalClosedType | None = None, + method: CalculationMethod = "single", *, - selection: IndexLabel | None = ..., + selection: IndexLabel | None = None, ) -> RollingGroupby[NDFrameT]: ... @final def expanding( @@ -255,22 +259,22 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def quantile( self, - q: float | AnyArrayLike = ..., - interpolation: str = ..., - numeric_only: bool = ..., + q: float | AnyArrayLike = 0.5, + interpolation: str = "linear", + 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 +301,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( @@ -323,9 +327,9 @@ class GroupBy(BaseGroupBy[NDFrameT]): @final def sample( self, - n: int | None = ..., - frac: float | None = ..., - replace: bool = ..., + n: int | None = None, + frac: float | None = None, + replace: bool = False, weights: Sequence | Series | None = ..., random_state: RandomState | None = ..., ) -> NDFrameT: ... @@ -371,7 +375,7 @@ class BaseGroupBy(SelectionMixin[NDFrameT], GroupByIndexingMixin): **kwargs: Any, ) -> T: ... @final - def get_group(self, name, obj: NDFrameT | 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 ed8d79461..704053c2e 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -45,16 +45,19 @@ from pandas._typing import ( C2, S1, AnyAll, + ArrayLike, AxesData, DropKeep, DtypeArg, DtypeObj, HashableT, + IgnoreRaise, Label, Level, MaskType, NaPosition, ReindexMethod, + Scalar, SliceType, TimedeltaDtypeArg, TimestampDtypeArg, @@ -289,12 +292,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 = ..., fill_value=..., **kwargs + self, + indices, + axis: int = 0, + allow_fill: bool = True, + fill_value: Scalar | None = 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 @@ -304,7 +312,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 @@ -321,7 +329,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 @@ -342,10 +350,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: ... @@ -357,15 +365,17 @@ 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 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, 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( @@ -392,8 +402,8 @@ class Index(IndexOpsMixin[S1]): def values(self) -> np.ndarray: ... @property def array(self) -> ExtensionArray: ... - def memory_usage(self, deep: bool = ...): ... - def where(self, cond, other=...): ... + def memory_usage(self, deep: bool = False): ... + def where(self, cond, other: Scalar | ArrayLike | None = None): ... def __contains__(self, key) -> bool: ... @final def __setitem__(self, key, value) -> None: ... @@ -435,12 +445,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=..., end=..., step=...): ... + 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 = ..., end: SliceType = ..., 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 = ...) -> Self: ... + def drop(self, labels, errors: IgnoreRaise = "raise") -> Self: ... @property def shape(self) -> tuple[int, ...]: ... # Extra methods from old stubs @@ -498,6 +515,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 bb7fae3fb..2be826208 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 = ...) -> Index: ... @property def is_unique(self) -> bool: ... @property @@ -47,9 +45,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] = ...): ... - @final - def where(self, cond, other=...): ... 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..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/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index 55d46319c..3a5063495 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, @@ -83,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: datetime | str, + end_time: datetime | str, + include_start: bool = True, + include_end: bool = True, ): ... def to_julian_date(self) -> Index[float]: ... def isocalendar(self) -> DataFrame: ... @@ -91,18 +96,20 @@ 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: DateOffset | Timedelta | str | None = None + ) -> Self: ... def date_range( - start: str | DateAndDatetimeLike | None = ..., - end: str | DateAndDatetimeLike | None = ..., - periods: int | None = ..., - freq: str | timedelta | Timedelta | BaseOffset = ..., - tz: TimeZones = ..., - normalize: bool = ..., - name: Hashable | None = ..., - inclusive: IntervalClosedType = ..., - unit: TimeUnit | None = ..., + start: str | DateAndDatetimeLike | None = None, + end: str | DateAndDatetimeLike | None = None, + periods: int | None = None, + freq: str | timedelta | Timedelta | BaseOffset = "D", + tz: TimeZones = None, + normalize: bool = False, + name: Hashable | None = None, + inclusive: IntervalClosedType = "both", + unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @overload def bdate_range( diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index 6bb081306..02518e738 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: ... def get_loc(self, key: Label) -> int | slice | npt.NDArray[np.bool_]: ... diff --git a/pandas-stubs/core/indexes/multi.pyi b/pandas-stubs/core/indexes/multi.pyi index cf7d51399..d51528d9d 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, @@ -77,7 +77,7 @@ class MultiIndex(Index): def codes(self): ... def set_codes(self, codes, *, level=..., verify_integrity: bool = ...): ... def copy( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore - self, names: SequenceNotStr[Hashable] = ..., deep: bool = ... + self, names: SequenceNotStr[Hashable] = ..., deep: bool = False ) -> Self: ... def view(self, cls=...): ... def __contains__(self, key) -> bool: ... @@ -85,7 +85,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( @@ -105,15 +105,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): ... @@ -131,23 +131,17 @@ class MultiIndex(Index): def __getitem__( # pyright: ignore[reportIncompatibleMethodOverride] self, key: int ) -> tuple: ... - def take( - self, indices, axis: int = ..., allow_fill: bool = ..., fill_value=..., **kwargs - ): ... - def argsort(self, *args, na_position: NaPosition = ..., **kwargs): ... def append(self, other): ... # pyrefly: ignore 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 swaplevel(self, i: int = ..., j: int = ...): ... + 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] = ..., - ascending: bool = ..., - sort_remaining: bool = ..., - na_position: NaPosition = ..., + level: Level | Sequence[Level] = 0, + ascending: bool = True, + sort_remaining: bool = True, + na_position: NaPosition = "first", ): ... @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... @@ -156,20 +150,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 = ...): ... + 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=..., after=...): ... + 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=...): ... # pyrefly: ignore - @final - def intersection( # pyright: ignore[reportIncompatibleMethodOverride] - self, other: list | Self, sort: bool | None = ... - ): ... - @final - def difference(self, other, sort=...): ... - def astype(self, dtype: DtypeArg, copy: bool = ...) -> 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 bd2ee053e..3dafef991 100644 --- a/pandas-stubs/core/indexes/period.pyi +++ b/pandas-stubs/core/indexes/period.pyi @@ -55,7 +55,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 = ...): ... def searchsorted(self, value, side: str = ..., sorter=...): ... @property def is_full(self) -> bool: ... @@ -75,21 +74,18 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): return_indexers: bool = ..., sort: bool = ..., ): ... - @final - def difference(self, other, sort=...): ... - def memory_usage(self, deep: bool = ...): ... @property def freqstr(self) -> str: ... - def shift(self, periods: int = ..., freq=...) -> Self: ... + def shift(self, periods: int = 1, freq=...) -> Self: ... 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 = ..., - freq: str | BaseOffset | None = ..., - name: Hashable | None = ..., + ) = None, + periods: int | None = None, + freq: str | BaseOffset | None = None, + name: Hashable | None = None, ) -> PeriodIndex: ... diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 6c673e4a0..5c2d18263 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -53,12 +53,11 @@ class RangeIndex(Index[int]): @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... def tolist(self): ... - def copy(self, name: Hashable = ..., deep: bool = ...): ... 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 @@ -79,7 +78,7 @@ class RangeIndex(Index[int]): def any(self, *args, **kwargs) -> bool: ... @final def union( # pyrefly: ignore - self, other: list[HashableT] | Index, sort=... + 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 6d50cdbd2..4c16f6e5d 100644 --- a/pandas-stubs/core/indexes/timedeltas.pyi +++ b/pandas-stubs/core/indexes/timedeltas.pyi @@ -70,21 +70,20 @@ 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 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 = ..., - end: TimedeltaConvertibleTypes = ..., - periods: int | None = ..., - freq: str | DateOffset | Timedelta | dt.timedelta | None = ..., - name: Hashable | None = ..., - closed: Literal["left", "right"] | None = ..., + start: TimedeltaConvertibleTypes | None = None, + end: TimedeltaConvertibleTypes | None = None, + periods: int | None = None, + freq: str | DateOffset | Timedelta | dt.timedelta | None = None, + name: Hashable | None = None, + closed: Literal["left", "right"] | None = None, *, unit: None | str = ..., ) -> TimedeltaIndex: ... 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/resample.pyi b/pandas-stubs/core/resample.pyi index b0a914162..ac315c489 100644 --- a/pandas-stubs/core/resample.pyi +++ b/pandas-stubs/core/resample.pyi @@ -116,31 +116,37 @@ 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 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 = False, + min_count: int = -1, + skipna: bool = True, ) -> NDFrameT: ... @final def last( - self, numeric_only: bool = ..., min_count: int = ..., skipna: bool = ... + self, + 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 @@ -156,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 6d7a2d5e3..dac498e03 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_sep: str = ..., - dummy_na: bool = ..., - columns: list[HashableT2] | None = ..., - sparse: bool = ..., - drop_first: bool = ..., - dtype: Dtype | None = ..., + prefix: str | Iterable[str] | dict[HashableT1, str] | None = None, + prefix_sep: str = "_", + dummy_na: bool = False, + columns: list[HashableT2] | None = None, + sparse: bool = False, + drop_first: bool = False, + dtype: Dtype | None = 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..68a9ee57d 100644 --- a/pandas-stubs/core/reshape/melt.pyi +++ b/pandas-stubs/core/reshape/melt.pyi @@ -7,21 +7,23 @@ from pandas._typing import HashableT def melt( frame: DataFrame, - id_vars: tuple | list | np.ndarray | None = ..., - value_vars: tuple | list | np.ndarray | None = ..., - var_name: str | None = ..., - value_name: Hashable = ..., - col_level: int | str | None = ..., - ignore_index: bool = ..., + 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 = None, + ignore_index: bool = True, ) -> DataFrame: ... def lreshape( - data: DataFrame, groups: dict[HashableT, list[HashableT]], dropna: bool = ... + data: DataFrame, + groups: dict[HashableT, list[HashableT]], + 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 5eb781f6a..cf5243cd2 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -23,16 +23,16 @@ from pandas._typing import ( def merge( left: DataFrame | Series, right: DataFrame | Series, - how: MergeHow = ..., - 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 = ..., + how: MergeHow = "inner", + 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 = ..., - validate: ValidationOptions = ..., + indicator: bool | str = False, + validate: ValidationOptions | None = 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 = ..., - allow_exact_matches: bool = ..., - direction: Literal["backward", "forward", "nearest"] = ..., + tolerance: int | timedelta | Timedelta | None = None, + allow_exact_matches: bool = True, + direction: Literal["backward", "forward", "nearest"] = "backward", ) -> DataFrame: ... diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index eedb84b02..aeac2c4a9 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -477,7 +477,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: ... @@ -742,7 +742,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dropna: _bool = ..., ) -> SeriesGroupBy[S1, Any]: ... def count(self) -> int: ... - def mode(self, dropna=...) -> Series[S1]: ... + def mode(self, dropna=True) -> Series[S1]: ... def unique(self) -> np.ndarray: ... @overload def drop_duplicates( @@ -760,14 +760,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 = ..., *args: Any, **kwargs: Any + self, + axis: AxisIndex = 0, + skipna: _bool = True, + *args: Any, + **kwargs: Any, ) -> int | _str: ... def idxmin( - self, axis: AxisIndex = ..., skipna: _bool = ..., *args: Any, **kwargs: Any + self, + axis: AxisIndex = 0, + 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, @@ -787,7 +795,7 @@ class Series(IndexOpsMixin[S1], NDFrame): min_periods: int | None = ..., ) -> float: ... def cov( - self, other: Series[S1], min_periods: int | None = ..., ddof: int = ... + 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] @@ -801,7 +809,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 @@ -913,27 +921,27 @@ class Series(IndexOpsMixin[S1], NDFrame): ) -> Series[S1]: ... def argsort( self, - axis: AxisIndex = ..., - kind: SortKind = ..., - order: None = ..., - stable: None = ..., + axis: AxisIndex = 0, + kind: SortKind = "quicksort", + order: None = None, + stable: None = 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 = -2, j: Level = -1, copy: _bool = True ) -> Series[S1]: ... def reorder_levels(self, order: list) -> Series[S1]: ... def explode(self, ignore_index: _bool = ...) -> Series[S1]: ... def unstack( self, - level: IndexLabel = ..., - fill_value: int | _str | dict | None = ..., - sort: _bool = ..., + level: IndexLabel = -1, + fill_value: int | _str | dict | None = None, + sort: _bool = True, ) -> DataFrame: ... @overload def map( @@ -1024,11 +1032,11 @@ class Series(IndexOpsMixin[S1], NDFrame): def align( self, other: DataFrame | Series, - join: JoinHow = ..., - axis: Axis | None = ..., - level: Level | None = ..., - copy: _bool = ..., - fill_value: Scalar | NAType | None = ..., + join: JoinHow = "outer", + axis: Axis | None = 0, + level: Level | None = None, + copy: _bool = True, + fill_value: Scalar | NAType | None = None, ) -> tuple[Series, Series]: ... @overload def rename( @@ -1078,10 +1086,10 @@ class Series(IndexOpsMixin[S1], NDFrame): def reindex_like( self, other: Series[S1], - method: FillnaOptions | Literal["nearest"] | None = ..., - copy: _bool = ..., - limit: int | None = ..., - tolerance: Scalar | AnyArrayLike | Sequence[Scalar] = ..., + method: FillnaOptions | Literal["nearest"] | None = None, + copy: _bool = True, + limit: int | None = None, + tolerance: Scalar | AnyArrayLike | Sequence[Scalar] | None = None, ) -> Self: ... @overload def fillna( @@ -1122,8 +1130,8 @@ class Series(IndexOpsMixin[S1], NDFrame): def shift( self, periods: int | Sequence[int] = ..., - freq: BaseOffset | timedelta | _str | None = ..., - axis: Axis = ..., + freq: BaseOffset | timedelta | _str | None = None, + axis: Axis = 0, fill_value: Scalar | NAType | None = ..., ) -> Series: ... def info( @@ -1133,7 +1141,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, @@ -1166,10 +1174,10 @@ class Series(IndexOpsMixin[S1], NDFrame): def to_timestamp( self, freq=..., - how: ToTimestampHow = ..., - copy: _bool = ..., + how: ToTimestampHow = "start", + copy: _bool = True, ) -> Series[S1]: ... - def to_period(self, freq: _str | None = ..., copy: _bool = ...) -> DataFrame: ... + def to_period(self, freq: _str | None = None, copy: _bool = True) -> DataFrame: ... @property def str( self, @@ -1190,17 +1198,17 @@ class Series(IndexOpsMixin[S1], NDFrame): sparse = ... def hist( self, - 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 = ..., - bins: int | Sequence = ..., - backend: _str | None = ..., - legend: _bool = ..., + by: object | None = None, + ax: PlotAxes | None = None, + 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 = 10, + backend: _str | None = None, + legend: _bool = False, **kwargs: Any, ) -> SubplotBase: ... @final @@ -1208,47 +1216,47 @@ 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 = ...) -> 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 = ..., - method: ReindexMethod | None = ..., - copy: bool = ..., - level: int | _str = ..., - fill_value: Scalar | None = ..., - limit: int | None = ..., - tolerance: float | None = ..., + index: Axes | None = None, + method: ReindexMethod | None = None, + copy: bool = True, + level: int | _str | None = None, + fill_value: Scalar | None = None, + limit: int | None = None, + tolerance: float | None = None, ) -> Series[S1]: ... def filter( self, - items: _ListLike | None = ..., - like: _str | None = ..., - regex: _str | None = ..., - axis: AxisIndex | None = ..., + items: _ListLike | None = None, + like: _str | None = None, + regex: _str | None = None, + 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 = ..., - weights: _str | _ListLike | np.ndarray | None = ..., - random_state: RandomState | None = ..., - axis: AxisIndex | None = ..., - ignore_index: _bool = ..., + n: int | None = None, + frac: float | None = None, + replace: _bool = False, + weights: _str | _ListLike | np.ndarray | None = None, + random_state: RandomState | None = None, + axis: AxisIndex | None = None, + ignore_index: _bool = False, ) -> Series[S1]: ... @overload def astype( @@ -1321,14 +1329,14 @@ 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, *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], limit: int | None = ..., limit_area: Literal["inside", "outside"] | None = ..., @@ -1337,7 +1345,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 = ..., @@ -1346,7 +1354,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 = ..., @@ -1355,7 +1363,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 = ..., @@ -1365,7 +1373,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 = ..., @@ -1377,7 +1385,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 = ..., @@ -1388,7 +1396,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] @@ -1396,7 +1404,7 @@ class Series(IndexOpsMixin[S1], NDFrame): lower: None = ..., upper: None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, inplace: Literal[True], **kwargs: Any, ) -> Self: ... @@ -1406,7 +1414,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: ... @@ -1416,33 +1424,33 @@ 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]: ... @final def asfreq( self, - freq, - method: FillnaOptions | None = ..., - how: Literal["start", "end"] | None = ..., - normalize: _bool = ..., - fill_value: Scalar | None = ..., + freq: DateOffset | _str, + method: FillnaOptions | None = None, + how: Literal["start", "end"] | None = None, + normalize: _bool = False, + fill_value: Scalar | None = None, ) -> Series[S1]: ... @final def at_time( self, time: _str | time, - asof: _bool = ..., - axis: AxisIndex | None = ..., + asof: _bool = False, + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final def between_time( self, start_time: _str | time, end_time: _str | time, - inclusive: IntervalClosedType = ..., - axis: AxisIndex | None = ..., + inclusive: IntervalClosedType = "both", + axis: AxisIndex | None = 0, ) -> Series[S1]: ... @final def first(self, offset) -> Series[S1]: ... @@ -1451,12 +1459,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( @@ -1471,7 +1479,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other=..., *, inplace: Literal[True], - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> None: ... @overload @@ -1487,7 +1495,7 @@ class Series(IndexOpsMixin[S1], NDFrame): other=..., *, inplace: Literal[False] = ..., - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, level: Level | None = ..., ) -> Self: ... @overload @@ -1503,7 +1511,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 @@ -1519,7 +1527,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( @@ -1538,26 +1546,26 @@ 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 def tz_convert( self, tz: TimeZones, - axis: AxisIndex = ..., - level: Level | None = ..., - copy: _bool = ..., + axis: AxisIndex = 0, + level: Level | None = None, + copy: _bool = True, ) -> Series[S1]: ... @final def tz_localize( self, tz: TimeZones, - axis: AxisIndex = ..., - level: Level | None = ..., - copy: _bool = ..., - ambiguous: TimeAmbiguous = ..., - nonexistent: _str = ..., + axis: AxisIndex = 0, + level: Level | None = None, + copy: _bool = True, + ambiguous: TimeAmbiguous = "raise", + nonexistent: _str = "raise", ) -> Series[S1]: ... @final def abs(self) -> Series[S1]: ... @@ -1571,11 +1579,9 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def pct_change( self, - periods: int = ..., - fill_method: None = ..., - freq: DateOffset | timedelta | _str | None = ..., - *, - fill_value: Scalar | NAType | None = ..., + periods: int = 1, + fill_method: None = None, + freq: DateOffset | timedelta | _str | None = None, ) -> Series[float]: ... @final def first_valid_index(self) -> Scalar: ... @@ -1651,65 +1657,65 @@ class Series(IndexOpsMixin[S1], NDFrame): def add( self: Series[Never], other: Scalar | _ListLike | Series, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series: ... @overload def add( self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[_T_COMPLEX]: ... @overload def add( self: Series[int], other: np_ndarray_anyint, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[int]: ... @overload def add( self: Series[int], other: np_ndarray_float, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[float]: ... @overload def add( self: Series[int], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def add( self: Series[float], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[float]: ... @overload def add( self: Series[float], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[_T_COMPLEX]: ... @overload def add( self: Series[float], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def add( @@ -1721,17 +1727,17 @@ class Series(IndexOpsMixin[S1], NDFrame): | np_ndarray_complex | Series[_T_COMPLEX] ), - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def add( self, other: S1 | Series[S1], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Self: ... @overload def __radd__(self: Series[Never], other: Scalar | _ListLike) -> Series: ... @@ -1772,65 +1778,65 @@ class Series(IndexOpsMixin[S1], NDFrame): def radd( self: Series[Never], other: Scalar | _ListLike | Series, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series: ... @overload def radd( self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[_T_COMPLEX]: ... @overload def radd( self: Series[int], other: np_ndarray_anyint, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[int]: ... @overload def radd( self: Series[int], other: np_ndarray_float, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[float]: ... @overload def radd( self: Series[int], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def radd( self: Series[float], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[float]: ... @overload def radd( self: Series[float], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[_T_COMPLEX]: ... @overload def radd( self: Series[float], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def radd( @@ -1842,17 +1848,17 @@ class Series(IndexOpsMixin[S1], NDFrame): | np_ndarray_complex | Series[_T_COMPLEX] ), - level: Level | None = ..., - fill_value: float | None = ..., - axis: int = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Series[complex]: ... @overload def radd( self, other: S1 | Series[S1], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: int = 0, ) -> Self: ... # ignore needed for mypy as we want different results based on the arguments @overload # type: ignore[override] @@ -1990,65 +1996,65 @@ class Series(IndexOpsMixin[S1], NDFrame): def truediv( self: Series[Never], other: Scalar | _ListLike | Series, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series: ... @overload def truediv( self, other: Series[Never], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series: ... @overload def truediv( self: Series[int], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[float]: ... @overload def truediv( self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[_T_COMPLEX]: ... @overload def truediv( self: Series[int], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def truediv( self: Series[float], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[float]: ... @overload def truediv( self: Series[float], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[_T_COMPLEX]: ... @overload def truediv( self: Series[float], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def truediv( @@ -2061,17 +2067,17 @@ class Series(IndexOpsMixin[S1], NDFrame): | np_ndarray_complex | Series[_T_COMPLEX] ), - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def truediv( self, other: Path, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series: ... div = truediv @overload @@ -2119,57 +2125,57 @@ class Series(IndexOpsMixin[S1], NDFrame): def rtruediv( self: Series[Never], other: Scalar | _ListLike | Series, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series: ... @overload def rtruediv( self: Series[int], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[float]: ... @overload def rtruediv( self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[_T_COMPLEX]: ... @overload def rtruediv( self: Series[int], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def rtruediv( self: Series[float], other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[float]: ... @overload def rtruediv( self: Series[float], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX], - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[_T_COMPLEX]: ... @overload def rtruediv( self: Series[float], other: np_ndarray_complex, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def rtruediv( @@ -2182,17 +2188,17 @@ class Series(IndexOpsMixin[S1], NDFrame): | np_ndarray_complex | Series[_T_COMPLEX] ), - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series[complex]: ... @overload def rtruediv( self, other: Path, - level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex = ..., + level: Level | None = None, + fill_value: float | None = None, + axis: AxisIndex = 0, ) -> Series: ... rdiv = rtruediv # ignore needed for mypy as we want different results based on the arguments @@ -2219,9 +2225,9 @@ class Series(IndexOpsMixin[S1], NDFrame): def loc(self) -> _LocIndexerSeries[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( @@ -2234,15 +2240,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]: ... @@ -2264,8 +2270,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]: ... @@ -2273,201 +2279,201 @@ 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[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 def ewm( self, - com: float | None = ..., - span: float | None = ..., - halflife: float | None = ..., - alpha: float | None = ..., - min_periods: int = ..., - adjust: _bool = ..., - ignore_na: _bool = ..., - axis: Axes = ..., - times: np.ndarray | Series | None = ..., - method: CalculationMethod = ..., + 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, + axis: Axis = 0, + times: np.ndarray | Series | None = None, + method: CalculationMethod = "single", ) -> ExponentialMovingWindow[Series]: ... @final def expanding( self, - min_periods: int = ..., - axis: Literal[0] = ..., - method: CalculationMethod = ..., + min_periods: int = 1, + axis: Literal[0] = 0, + method: CalculationMethod = "single", ) -> Expanding[Series]: ... def floordiv( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> 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 def item(self) -> S1: ... def kurt( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., - numeric_only: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def kurtosis( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., - numeric_only: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... def le( 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( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> S1: ... def mean( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def median( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def min( self, - axis: AxisIndex | None = ..., - skipna: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool = True, level: None = ..., - numeric_only: _bool = ..., + numeric_only: _bool = False, **kwargs: Any, ) -> S1: ... def mod( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = 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 = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> 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 - def nunique(self, dropna: _bool = ...) -> int: ... + def nunique(self, dropna: _bool = True) -> int: ... def pow( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> Series[S1]: ... def prod( self, - axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - numeric_only: _bool = ..., - min_count: int = ..., + axis: AxisIndex | None = 0, + 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 = ..., + axis: AxisIndex | None = 0, + skipna: _bool | None = True, + numeric_only: _bool = False, + min_count: int = 0, **kwargs: Any, ) -> Scalar: ... 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 @@ -2475,7 +2481,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 @@ -2483,7 +2489,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 @@ -2516,57 +2522,57 @@ 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 sem( self, - axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + axis: AxisIndex | None = 0, + 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 = ..., + axis: AxisIndex | None = 0, + 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 = ..., + axis: AxisIndex | None = 0, + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> float: ... def sub( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = None, + axis: AxisIndex | None = 0, ) -> Series[S1]: ... def subtract( self, other: num | _ListLike | Series[S1], level: Level | None = ..., - fill_value: float | None = ..., - axis: AxisIndex | None = ..., + fill_value: float | None = 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 = ..., @@ -2576,7 +2582,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 = ..., @@ -2585,7 +2591,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 = ..., @@ -2596,17 +2602,17 @@ 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: ... def tolist(self) -> list[S1]: ... def var( self, - axis: AxisIndex | None = ..., - skipna: _bool | None = ..., - ddof: int = ..., - numeric_only: _bool = ..., + axis: AxisIndex | None = 0, + skipna: _bool | None = True, + ddof: int = 1, + numeric_only: _bool = False, **kwargs: Any, ) -> Scalar: ... # Rename axis with `mapper`, `axis`, and `inplace=True` @@ -2615,7 +2621,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, mapper: Scalar | ListLike | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, copy: _bool = ..., inplace: Literal[True], ) -> None: ... @@ -2625,7 +2631,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, mapper: Scalar | ListLike | None = ..., *, - axis: AxisIndex | None = ..., + axis: AxisIndex | None = 0, copy: _bool = ..., inplace: Literal[False] = ..., ) -> Self: ... @@ -2653,9 +2659,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: ... @@ -2681,7 +2687,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 = ..., @@ -2689,7 +2695,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 = ..., @@ -2697,7 +2703,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 = ..., @@ -2785,7 +2791,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 = ..., @@ -2793,7 +2799,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 = ..., @@ -2801,7 +2807,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 = ..., @@ -2811,7 +2817,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, diff --git a/pandas-stubs/core/util/hashing.pyi b/pandas-stubs/core/util/hashing.pyi index cedae1308..fa59fc2ce 100644 --- a/pandas-stubs/core/util/hashing.pyi +++ b/pandas-stubs/core/util/hashing.pyi @@ -12,11 +12,14 @@ from pandas._typing import ( def hash_pandas_object( obj: Index | Series | DataFrame, - index: bool = ..., - encoding: str = ..., - hash_key: str | None = ..., - categorize: bool = ..., + index: bool = True, + encoding: str = "utf8", + hash_key: str | None = "0123456789123456", + categorize: bool = True, ) -> Series: ... def hash_array( - vals: ArrayLike, encoding: str = ..., hash_key: str = ..., categorize: bool = ... + vals: ArrayLike, + encoding: str = "utf8", + 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 15e48ef28..d3f322b56 100644 --- a/pandas-stubs/core/window/ewm.pyi +++ b/pandas-stubs/core/window/ewm.pyi @@ -14,37 +14,32 @@ from pandas._typing import ( ) class ExponentialMovingWindow(BaseWindow[NDFrameT]): - def online( - self, - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., - ) -> OnlineExponentialMovingWindow[NDFrameT]: ... def mean( self, - numeric_only: bool = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + numeric_only: bool = False, + engine: WindowingEngine = None, + engine_kwargs: WindowingEngineKwargs = None, ) -> NDFrameT: ... def sum( self, - numeric_only: bool = ..., - engine: WindowingEngine = ..., - engine_kwargs: WindowingEngineKwargs = ..., + 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 = ..., - bias: bool = ..., - numeric_only: bool = ..., + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + bias: bool = False, + numeric_only: bool = False, ) -> NDFrameT: ... def corr( self, - other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., - numeric_only: bool = ..., + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + numeric_only: bool = False, ) -> NDFrameT: ... class ExponentialMovingWindowGroupby( @@ -54,21 +49,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 = ..., - numeric_only: bool = ..., + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + numeric_only: bool = False, ): ... def cov( self, - other: DataFrame | Series | None = ..., - pairwise: bool | None = ..., - bias: bool = ..., - numeric_only: bool = ..., + other: DataFrame | Series | None = None, + pairwise: bool | None = None, + 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 f601d2d4f..0fe824737 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/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/pandas-stubs/io/clipboards.pyi b/pandas-stubs/io/clipboards.pyi index 2aaba3806..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 = ..., sep: str | None = ..., **kwargs: Any -) -> None: ... diff --git a/pandas-stubs/io/feather_format.pyi b/pandas-stubs/io/feather_format.pyi index 47029882c..5861da0a0 100644 --- a/pandas-stubs/io/feather_format.pyi +++ b/pandas-stubs/io/feather_format.pyi @@ -11,8 +11,8 @@ from pandas._typing import ( def read_feather( path: FilePath | ReadBuffer[bytes], - columns: list[HashableT] | None = ..., - use_threads: bool = ..., - storage_options: StorageOptions = ..., - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + columns: list[HashableT] | None = None, + use_threads: bool = True, + storage_options: StorageOptions = None, + 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 cf0ec7f61..6da2bc13a 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -99,22 +99,22 @@ class Styler(StylerRenderer): def to_excel( self, excel_writer: FilePath | WriteExcelBuffer | ExcelWriter, - sheet_name: str = ..., - na_rep: str = ..., - float_format: str | None = ..., - columns: list[HashableT1] | None = ..., - header: list[HashableT2] | bool = ..., - index: bool = ..., - index_label: IndexLabel | None = ..., - startrow: int = ..., - startcol: int = ..., - engine: Literal["openpyxl", "xlsxwriter"] | None = ..., - merge_cells: ExcelWriterMergeCells = ..., - encoding: str | None = ..., - inf_rep: str = ..., - verbose: bool = ..., - freeze_panes: tuple[int, int] | None = ..., - storage_options: StorageOptions | None = ..., + sheet_name: str = "Sheet1", + na_rep: str = "", + float_format: str | None = None, + columns: list[HashableT1] | None = None, + header: list[HashableT2] | bool = True, + index: bool = True, + index_label: IndexLabel | None = None, + startrow: int = 0, + startcol: int = 0, + engine: Literal["openpyxl", "xlsxwriter"] | None = None, + merge_cells: ExcelWriterMergeCells = True, + encoding: str | None = None, + inf_rep: str = "inf", + verbose: bool = True, + freeze_panes: tuple[int, int] | None = None, + storage_options: StorageOptions | None = None, ) -> None: ... @overload def to_latex( @@ -263,16 +263,16 @@ class Styler(StylerRenderer): def set_caption(self, caption: str | tuple[str, str]) -> Styler: ... def set_sticky( self, - axis: Axis = ..., - pixel_size: int | None = ..., - levels: Level | list[Level] | None = ..., + axis: Axis = 0, + pixel_size: int | None = None, + levels: Level | list[Level] | None = None, ) -> Styler: ... def set_table_styles( self, - table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = ..., - axis: Axis = ..., - overwrite: bool = ..., - css_class_names: dict[str, str] | None = ..., + table_styles: dict[HashableT, CSSStyles] | CSSStyles | None = None, + axis: Axis = 0, + overwrite: bool = True, + 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 = ..., - axis: Axis | None = ..., - subset: Subset | None = ..., - text_color_threshold: float = ..., - vmin: float | None = ..., - vmax: float | None = ..., + cmap: str | Colormap = "PuBu", + low: float = 0, + high: float = 0, + axis: Axis | None = 0, + 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 = ..., - axis: Axis | None = ..., - subset: Subset | None = ..., - # In docs but not in function declaration - # text_color_threshold: float - vmin: float | None = ..., - vmax: float | None = ..., + cmap: str | Colormap = "PuBu", + low: float = 0, + high: float = 0, + axis: Axis | None = 0, + subset: Subset | None = None, + vmin: float | None = None, + vmax: float | None = None, gmap: ( Sequence[float] | Sequence[Sequence[float]] @@ -318,69 +316,69 @@ 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 = ..., - axis: Axis | 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 = ..., - subset: Subset | None = ..., - props: str | None = ..., + color: str | None = "red", + subset: Subset | None = None, + props: str | None = None, ) -> Styler: ... def highlight_max( self, - subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., - props: str | None = ..., + subset: Subset | None = 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 = ..., - props: str | None = ..., + subset: Subset | None = 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 = ..., - left: Scalar | list[Scalar] | None = ..., - right: Scalar | list[Scalar] | None = ..., - inclusive: IntervalClosedType = ..., - props: str | 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 = "both", + props: str | None = None, ) -> Styler: ... def highlight_quantile( self, - subset: Subset | None = ..., - color: str = ..., - axis: Axis | None = ..., - q_left: float = ..., - q_right: float = ..., - interpolation: QuantileInterpolation = ..., - inclusive: IntervalClosedType = ..., - props: str | None = ..., + subset: Subset | None = None, + color: str = "yellow", + axis: Axis | None = 0, + q_left: float = 0, + q_right: float = 1, + interpolation: QuantileInterpolation = "linear", + inclusive: IntervalClosedType = "both", + 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..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 = ..., - decimal: str = ..., - thousands: str | None = ..., - escape: str | None = ..., - hyperlinks: Literal["html", "latex"] | 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 = 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 = ..., - decimal: str = ..., - thousands: str | None = ..., - escape: str | None = ..., - hyperlinks: Literal["html", "latex"] | 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 = None, + hyperlinks: Literal["html", "latex"] | None = None, ) -> Self: ... def relabel_index( self, diff --git a/pandas-stubs/io/json/_normalize.pyi b/pandas-stubs/io/json/_normalize.pyi index 7239f03da..828cedefc 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 = ..., - errors: IgnoreRaise = ..., - sep: str = ..., - max_level: int | 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 = "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 be90d86e4..7039598e7 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 = ..., - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + columns: list[HashableT] | None = None, + dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", # 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/parquet.pyi b/pandas-stubs/io/parquet.pyi index fef8ee3a6..c9c9bd154 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 = ..., - columns: list[str] | None = ..., - storage_options: StorageOptions = ..., - dtype_backend: DtypeBackend = ..., + engine: ParquetEngine = "auto", + 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, **kwargs: Any, diff --git a/pandas-stubs/io/pickle.pyi b/pandas-stubs/io/pickle.pyi index b2ead7903..1265a5406 100644 --- a/pandas-stubs/io/pickle.pyi +++ b/pandas-stubs/io/pickle.pyi @@ -5,18 +5,10 @@ from pandas._typing import ( FilePath, ReadPickleBuffer, StorageOptions, - WriteBuffer, ) -def to_pickle( - obj: object, - filepath_or_buffer: FilePath | WriteBuffer[bytes], - compression: CompressionOptions = ..., - protocol: int = ..., - storage_options: StorageOptions = ..., -) -> None: ... def read_pickle( filepath_or_buffer: FilePath | ReadPickleBuffer, - compression: CompressionOptions = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + storage_options: StorageOptions = None, ) -> Any: ... diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index db06bac03..28f0f8575 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -122,9 +122,8 @@ 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 close(self) -> None: ... @property def is_open(self) -> bool: ... @@ -171,15 +170,15 @@ class HDFStore: self, key: str, value: NDFrame, - format: Literal["t", "table", "f", "fixed"] = ..., - index: bool = ..., - append: bool = ..., - complib: HDFCompLib | None = ..., - complevel: int | None = ..., - min_itemsize: int | dict[HashableT1, int] | None = ..., - nan_rep: str | None = ..., - data_columns: Literal[True] | list[HashableT2] | None = ..., - encoding: str | None = ..., + format: Literal["t", "table", "f", "fixed"] | None = None, + index: bool = True, + append: bool = False, + 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[ "strict", "ignore", @@ -188,28 +187,28 @@ class HDFStore: "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., - track_times: bool = ..., - dropna: bool = ..., + ] = "strict", + track_times: bool = True, + dropna: bool = False, ) -> None: ... def append( self, key: str, value: NDFrame, - format: Literal["t", "table", "f", "fixed"] = ..., - axes: int | None = ..., - index: bool = ..., - append: bool = ..., - 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 = ..., - dropna: bool | None = ..., - data_columns: Literal[True] | list[HashableT3] | None = ..., - encoding: str | None = ..., + format: Literal["t", "table", "f", "fixed"] | None = None, + axes: int | None = None, + index: bool = True, + append: bool = True, + 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, errors: Literal[ "strict", "ignore", @@ -218,11 +217,11 @@ class HDFStore: "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., + ] = "strict", ) -> 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 52d4a23ec..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 = ..., - convert_categoricals: bool = ..., - dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., + usecols: list[HashableT] | None = None, + convert_categoricals: bool = True, + dtype_backend: DtypeBackend | _NoDefaultDoNotUse = "numpy_nullable", ) -> DataFrame: ... diff --git a/pandas-stubs/io/stata.pyi b/pandas-stubs/io/stata.pyi index 17f1e5bb9..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 = ...) -> DataFrame: ... - def read( - self, - nrows: int | None = ..., - convert_dates: bool | None = ..., - convert_categoricals: bool | None = ..., - index_col: str | None = ..., - convert_missing: bool | None = ..., - preserve_dtypes: bool | None = ..., - columns: list[str] | None = ..., - order_categoricals: bool | None = ..., - ): ... @property def data_label(self) -> str: ... def variable_labels(self) -> dict[str, str]: ... diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index 6db741faf..c52ca2569 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -32,56 +32,56 @@ 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 = ..., - range_padding: float = ..., + 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 = ..., - colormap: str | Colormap | None = ..., + ax: Axes | None = None, + color: _Color | Sequence[_Color] | None = None, + colormap: str | Colormap | None = None, **kwds, ) -> Axes: ... def andrews_curves( frame: DataFrame, class_column: Hashable, - ax: Axes | None = ..., - samples: int = ..., - color: _Color | Sequence[_Color] | None = ..., - colormap: str | Colormap | None = ..., + ax: Axes | None = None, + samples: int = 200, + color: _Color | Sequence[_Color] | None = None, + colormap: str | Colormap | None = None, **kwargs, ) -> Axes: ... def bootstrap_plot( series: Series, - fig: Figure | None = ..., - size: int = ..., - samples: int = ..., + fig: Figure | None = None, + size: int = 50, + samples: int = 500, **kwds, ) -> Figure: ... 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 = ..., - colormap: str | Colormap | None = ..., - axvlines: bool = ..., - axvlines_kwds: dict[str, Any] | None = ..., - sort_labels: bool = ..., + 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 = True, + axvlines_kwds: dict[str, Any] | None = None, + sort_labels: bool = False, **kwargs, ) -> Axes: ... -def lag_plot(series: Series, lag: int = ..., 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] diff --git a/pandas-stubs/util/_doctools.pyi b/pandas-stubs/util/_doctools.pyi deleted file mode 100644 index 3d455cb44..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 = ...): ... 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 deleted file mode 100644 index a02a1c11c..000000000 --- a/pandas-stubs/util/_tester.pyi +++ /dev/null @@ -1 +0,0 @@ -def test(extra_args: list[str] | None = ..., run_doctests: bool = ...) -> None: ... diff --git a/tests/series/test_series.py b/tests/series/test_series.py index c194d994d..cca4014d9 100644 --- a/tests/series/test_series.py +++ b/tests/series/test_series.py @@ -482,11 +482,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: diff --git a/tests/test_indexes.py b/tests/test_indexes.py index b713f231d..e619151b8 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, 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: