From 0f4ac7ccf9e1faf10823a93592a2b929fd8fed55 Mon Sep 17 00:00:00 2001 From: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Wed, 13 Aug 2025 10:26:46 +0100 Subject: [PATCH] Add more parameter defaults --- pandas-stubs/_testing/__init__.pyi | 40 +++++------ pandas-stubs/core/algorithms.pyi | 18 ++--- pandas-stubs/core/computation/eval.pyi | 2 +- pandas-stubs/core/groupby/generic.pyi | 62 ++++++++--------- pandas-stubs/core/indexes/datetimes.pyi | 26 +++---- pandas-stubs/core/indexes/interval.pyi | 44 ++++++------ pandas-stubs/core/reshape/merge.pyi | 42 +++++------ pandas-stubs/core/reshape/pivot.pyi | 44 ++++++------ pandas-stubs/core/reshape/tile.pyi | 92 ++++++++++++------------- pandas-stubs/core/tools/datetimes.pyi | 62 ++++++++--------- pandas-stubs/core/tools/numeric.pyi | 12 ++-- pandas-stubs/core/tools/timedeltas.pyi | 12 ++-- pandas-stubs/io/clipboards.pyi | 6 +- pandas-stubs/io/excel/_base.pyi | 2 +- pandas-stubs/io/pytables.pyi | 48 ++++++------- pandas-stubs/io/sql.pyi | 66 +++++++++--------- pandas-stubs/plotting/_core.pyi | 50 +++++++------- 17 files changed, 314 insertions(+), 314 deletions(-) diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index 9ad256f4b..1e01e91f4 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -115,19 +115,19 @@ def assert_extension_array_equal( def assert_series_equal( left: Series, right: Series, - check_dtype: bool | Literal["equiv"] = ..., - check_index_type: bool | Literal["equiv"] = ..., - check_series_type: bool = ..., - check_names: bool = ..., + check_dtype: bool | Literal["equiv"] = True, + check_index_type: bool | Literal["equiv"] = "equiv", + check_series_type: bool = True, + check_names: bool = True, check_exact: bool = ..., - check_datetimelike_compat: bool = ..., - check_categorical: bool = ..., - check_category_order: bool = ..., - check_freq: bool = ..., - check_flags: bool = ..., + check_datetimelike_compat: bool = False, + check_categorical: bool = True, + check_category_order: bool = True, + check_freq: bool = True, + check_flags: bool = True, rtol: float = ..., atol: float = ..., - obj: str = ..., + obj: str = "Series", *, check_index: Literal[False], check_like: Literal[False] = ..., @@ -136,19 +136,19 @@ def assert_series_equal( def assert_series_equal( left: Series, right: Series, - check_dtype: bool | Literal["equiv"] = ..., - check_index_type: bool | Literal["equiv"] = ..., - check_series_type: bool = ..., - check_names: bool = ..., + check_dtype: bool | Literal["equiv"] = True, + check_index_type: bool | Literal["equiv"] = "equiv", + check_series_type: bool = True, + check_names: bool = True, check_exact: bool = ..., - check_datetimelike_compat: bool = ..., - check_categorical: bool = ..., - check_category_order: bool = ..., - check_freq: bool = ..., - check_flags: bool = ..., + check_datetimelike_compat: bool = False, + check_categorical: bool = True, + check_category_order: bool = True, + check_freq: bool = True, + check_flags: bool = True, rtol: float = ..., atol: float = ..., - obj: str = ..., + obj: str = "Series", *, check_index: Literal[True] = ..., check_like: bool = ..., diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index 803878ba8..fa977769b 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -44,23 +44,23 @@ def unique(values: ExtensionArray) -> ExtensionArray: ... @overload def factorize( values: np.ndarray, - sort: bool = ..., - use_na_sentinel: bool = ..., - size_hint: int | None = ..., + sort: bool = False, + use_na_sentinel: bool = True, + size_hint: int | None = None, ) -> tuple[np.ndarray, np.ndarray]: ... @overload def factorize( values: Index | Series, - sort: bool = ..., - use_na_sentinel: bool = ..., - size_hint: int | None = ..., + sort: bool = False, + use_na_sentinel: bool = True, + size_hint: int | None = None, ) -> tuple[np.ndarray, Index]: ... @overload def factorize( values: Categorical, - sort: bool = ..., - use_na_sentinel: bool = ..., - size_hint: int | None = ..., + sort: bool = False, + use_na_sentinel: bool = True, + size_hint: int | None = None, ) -> tuple[np.ndarray, Categorical]: ... def value_counts( values: AnyArrayLike | list | tuple, diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index 19df29909..61c26dd8c 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -18,7 +18,7 @@ from pandas._typing import ( def eval( expr: str | BinOp, parser: Literal["pandas", "python"] = "pandas", - engine: Literal["python", "numexpr"] | None = ..., + engine: Literal["python", "numexpr"] | None = None, local_dict: dict[str, Any] | None = None, global_dict: dict[str, Any] | None = None, resolvers: list[Mapping] | None = ..., diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index 75430c052..2787bcd7b 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -308,49 +308,49 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): @overload def boxplot( self, - subplots: Literal[True] = ..., - column: IndexLabel | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - ax: PlotAxes | None = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - sharex: bool = ..., - sharey: bool = ..., - backend: str | None = ..., + subplots: Literal[True] = True, + column: IndexLabel | None = None, + fontsize: float | str | None = None, + rot: float = 0, + grid: bool = True, + ax: PlotAxes | None = None, + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, + sharex: bool = False, + sharey: bool = True, + backend: str | None = None, **kwargs, ) -> Series: ... # Series[PlotAxes] but this is not allowed @overload def boxplot( self, subplots: Literal[False], - column: IndexLabel | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - ax: PlotAxes | None = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - sharex: bool = ..., - sharey: bool = ..., - backend: str | None = ..., + column: IndexLabel | None = None, + fontsize: float | str | None = None, + rot: float = 0, + grid: bool = True, + ax: PlotAxes | None = None, + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, + sharex: bool = False, + sharey: bool = True, + backend: str | None = None, **kwargs, ) -> PlotAxes: ... @overload def boxplot( self, subplots: bool, - column: IndexLabel | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - ax: PlotAxes | None = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - sharex: bool = ..., - sharey: bool = ..., - backend: str | None = ..., + column: IndexLabel | None = None, + fontsize: float | str | None = None, + rot: float = 0, + grid: bool = True, + ax: PlotAxes | None = None, + figsize: tuple[float, float] | None = None, + layout: tuple[int, int] | None = None, + sharex: bool = False, + sharey: bool = True, + backend: str | None = None, **kwargs, ) -> PlotAxes | Series: ... # Series[PlotAxes] @overload diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index c79856ff7..0e066a4d8 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -113,22 +113,22 @@ def date_range( ) -> DatetimeIndex: ... @overload def bdate_range( - start: str | DateAndDatetimeLike | None = ..., - end: str | DateAndDatetimeLike | None = ..., - periods: int | None = ..., - freq: str | timedelta | Timedelta | BaseOffset = ..., - tz: TimeZones = ..., - normalize: bool = ..., - name: Hashable | None = ..., - weekmask: str | None = ..., - holidays: None = ..., - inclusive: IntervalClosedType = ..., + start: str | DateAndDatetimeLike | None = None, + end: str | DateAndDatetimeLike | None = None, + periods: int | None = None, + freq: str | timedelta | Timedelta | BaseOffset = "B", + tz: TimeZones = None, + normalize: bool = True, + name: Hashable | None = None, + weekmask: str | None = None, + holidays: None = None, + inclusive: IntervalClosedType = "both", ) -> DatetimeIndex: ... @overload def bdate_range( - start: str | DateAndDatetimeLike | None = ..., - end: str | DateAndDatetimeLike | None = ..., - periods: int | None = ..., + start: str | DateAndDatetimeLike | None = None, + end: str | DateAndDatetimeLike | None = None, + periods: int | None = None, *, freq: str | timedelta | Timedelta | BaseOffset, tz: TimeZones = ..., diff --git a/pandas-stubs/core/indexes/interval.pyi b/pandas-stubs/core/indexes/interval.pyi index b82cdeddb..61e35a45e 100644 --- a/pandas-stubs/core/indexes/interval.pyi +++ b/pandas-stubs/core/indexes/interval.pyi @@ -310,30 +310,30 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin): # int gets hit first and so the correct type is returned @overload def interval_range( # pyright: ignore[reportOverlappingOverload] - start: int | None = ..., - end: int | None = ..., - periods: int | None = ..., - freq: int | None = ..., - name: Hashable = ..., - closed: IntervalClosedType = ..., + start: int | None = None, + end: int | None = None, + periods: int | None = None, + freq: int | None = None, + name: Hashable = None, + closed: IntervalClosedType = "right", ) -> IntervalIndex[Interval[int]]: ... @overload def interval_range( - start: float | None = ..., - end: float | None = ..., - periods: int | None = ..., - freq: int | None = ..., - name: Hashable = ..., - closed: IntervalClosedType = ..., + start: float | None = None, + end: float | None = None, + periods: int | None = None, + freq: int | None = None, + name: Hashable = None, + closed: IntervalClosedType = "right", ) -> IntervalIndex[Interval[float]]: ... @overload def interval_range( start: _TimestampLike, - end: _TimestampLike | None = ..., - periods: int | None = ..., - freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., - name: Hashable = ..., - closed: IntervalClosedType = ..., + end: _TimestampLike | None = None, + periods: int | None = None, + freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = None, + name: Hashable = None, + closed: IntervalClosedType = "right", ) -> IntervalIndex[Interval[pd.Timestamp]]: ... @overload def interval_range( @@ -348,11 +348,11 @@ def interval_range( @overload def interval_range( start: _TimedeltaLike, - end: _TimedeltaLike | None = ..., - periods: int | None = ..., - freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ..., - name: Hashable = ..., - closed: IntervalClosedType = ..., + end: _TimedeltaLike | None = None, + periods: int | None = None, + freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = None, + name: Hashable = None, + closed: IntervalClosedType = "right", ) -> IntervalIndex[Interval[pd.Timedelta]]: ... @overload def interval_range( diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index cf5243cd2..0006c8916 100644 --- a/pandas-stubs/core/reshape/merge.pyi +++ b/pandas-stubs/core/reshape/merge.pyi @@ -38,42 +38,42 @@ def merge( def merge_ordered( left: DataFrame, right: DataFrame, - on: Label | list[HashableT] | None = ..., - left_on: Label | list[HashableT] | None = ..., - right_on: Label | list[HashableT] | None = ..., - left_by: Label | list[HashableT] | None = ..., - right_by: Label | list[HashableT] | None = ..., - fill_method: Literal["ffill"] | None = ..., + on: Label | list[HashableT] | None = None, + left_on: Label | list[HashableT] | None = None, + right_on: Label | list[HashableT] | None = None, + left_by: Label | list[HashableT] | None = None, + right_by: Label | list[HashableT] | None = None, + fill_method: Literal["ffill"] | None = None, suffixes: Suffixes = ..., - how: JoinHow = ..., + how: JoinHow = "outer", ) -> DataFrame: ... @overload def merge_ordered( left: Series, right: DataFrame | Series, - on: Label | list[HashableT] | None = ..., - left_on: Label | list[HashableT] | None = ..., - right_on: Label | list[HashableT] | None = ..., - left_by: None = ..., - right_by: None = ..., - fill_method: Literal["ffill"] | None = ..., + on: Label | list[HashableT] | None = None, + left_on: Label | list[HashableT] | None = None, + right_on: Label | list[HashableT] | None = None, + left_by: None = None, + right_by: None = None, + fill_method: Literal["ffill"] | None = None, suffixes: ( list[str | None] | tuple[str, str] | tuple[None, str] | tuple[str, None] ) = ..., - how: JoinHow = ..., + how: JoinHow = "outer", ) -> DataFrame: ... @overload def merge_ordered( left: DataFrame | Series, right: Series, - on: Label | list[HashableT] | None = ..., - left_on: Label | list[HashableT] | None = ..., - right_on: Label | list[HashableT] | None = ..., - left_by: None = ..., - right_by: None = ..., - fill_method: Literal["ffill"] | None = ..., + on: Label | list[HashableT] | None = None, + left_on: Label | list[HashableT] | None = None, + right_on: Label | list[HashableT] | None = None, + left_by: None = None, + right_by: None = None, + fill_method: Literal["ffill"] | None = None, suffixes: Suffixes = ..., - how: JoinHow = ..., + how: JoinHow = "outer", ) -> DataFrame: ... def merge_asof( left: DataFrame | Series, diff --git a/pandas-stubs/core/reshape/pivot.pyi b/pandas-stubs/core/reshape/pivot.pyi index 5554ce6fb..8830f2f5b 100644 --- a/pandas-stubs/core/reshape/pivot.pyi +++ b/pandas-stubs/core/reshape/pivot.pyi @@ -64,25 +64,25 @@ _ExtendedAnyArrayLike: TypeAlias = AnyArrayLike | ArrayLike @overload def pivot_table( data: DataFrame, - values: _PivotTableValuesTypes = ..., - index: _PivotTableIndexTypes = ..., - columns: _PivotTableColumnsTypes = ..., + values: _PivotTableValuesTypes = None, + index: _PivotTableIndexTypes = None, + columns: _PivotTableColumnsTypes = None, aggfunc: ( _PivotAggFunc | Sequence[_PivotAggFunc] | Mapping[Hashable, _PivotAggFunc] - ) = ..., - fill_value: Scalar | None = ..., - margins: bool = ..., - dropna: bool = ..., - margins_name: str = ..., + ) = "mean", + fill_value: Scalar | None = None, + margins: bool = False, + dropna: bool = True, + margins_name: str = "All", observed: bool = ..., - sort: bool = ..., + sort: bool = True, ) -> DataFrame: ... # Can only use Index or ndarray when index or columns is a Grouper @overload def pivot_table( data: DataFrame, - values: _PivotTableValuesTypes = ..., + values: _PivotTableValuesTypes = None, *, index: Grouper, columns: _PivotTableColumnsTypes | Index | npt.NDArray = ..., @@ -99,8 +99,8 @@ def pivot_table( @overload def pivot_table( data: DataFrame, - values: _PivotTableValuesTypes = ..., - index: _PivotTableIndexTypes | Index | npt.NDArray = ..., + values: _PivotTableValuesTypes = None, + index: _PivotTableIndexTypes | Index | npt.NDArray = None, *, columns: Grouper, aggfunc: ( @@ -125,8 +125,8 @@ def crosstab( index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike], columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike], values: list | _ExtendedAnyArrayLike, - rownames: list[HashableT1] | None = ..., - colnames: list[HashableT2] | None = ..., + rownames: list[HashableT1] | None = None, + colnames: list[HashableT2] | None = None, *, aggfunc: str | np.ufunc | Callable[[Series], float], margins: bool = ..., @@ -138,12 +138,12 @@ def crosstab( def crosstab( index: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike], columns: list | _ExtendedAnyArrayLike | list[Sequence | _ExtendedAnyArrayLike], - values: None = ..., - rownames: list[HashableT1] | None = ..., - colnames: list[HashableT2] | None = ..., - aggfunc: None = ..., - margins: bool = ..., - margins_name: str = ..., - dropna: bool = ..., - normalize: bool | Literal[0, 1, "all", "index", "columns"] = ..., + values: None = None, + rownames: list[HashableT1] | None = None, + colnames: list[HashableT2] | None = None, + aggfunc: None = None, + margins: bool = False, + margins_name: str = "All", + dropna: bool = True, + normalize: bool | Literal[0, 1, "all", "index", "columns"] = False, ) -> DataFrame: ... diff --git a/pandas-stubs/core/reshape/tile.pyi b/pandas-stubs/core/reshape/tile.pyi index 336426cc9..c17ffe233 100644 --- a/pandas-stubs/core/reshape/tile.pyi +++ b/pandas-stubs/core/reshape/tile.pyi @@ -27,7 +27,7 @@ from pandas._typing import ( def cut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], bins: int | Series | Index[int] | Index[float] | Sequence[int] | Sequence[float], - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[True], @@ -40,7 +40,7 @@ def cut( def cut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], bins: IntervalIndex[IntervalT], - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[True], @@ -59,8 +59,8 @@ def cut( # pyright: ignore[reportOverlappingOverload] | Sequence[Timestamp] | Sequence[np.datetime64] ), - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -72,8 +72,8 @@ def cut( # pyright: ignore[reportOverlappingOverload] def cut( x: TimestampSeries, bins: IntervalIndex[Interval[Timestamp]], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -85,8 +85,8 @@ def cut( def cut( x: Series, bins: int | Series | Index[int] | Index[float] | Sequence[int] | Sequence[float], - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -98,8 +98,8 @@ def cut( def cut( x: Series, bins: IntervalIndex[Interval[int]] | IntervalIndex[Interval[float]], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -111,8 +111,8 @@ def cut( def cut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], bins: int | Series | Index[int] | Index[float] | Sequence[int] | Sequence[float], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -124,8 +124,8 @@ def cut( def cut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], bins: IntervalIndex[IntervalT], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -145,7 +145,7 @@ def cut( | Sequence[float] | IntervalIndex ), - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[False] = ..., @@ -165,13 +165,13 @@ def cut( | Sequence[np.datetime64] | IntervalIndex[Interval[Timestamp]] ), - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., - retbins: Literal[False] = ..., - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, + retbins: Literal[False] = False, + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Series[CategoricalDtype]: ... @overload def cut( @@ -185,13 +185,13 @@ def cut( | Sequence[float] | IntervalIndex ), - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., - retbins: Literal[False] = ..., - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, + retbins: Literal[False] = False, + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Series: ... @overload def cut( @@ -205,13 +205,13 @@ def cut( | Sequence[float] | IntervalIndex ), - right: bool = ..., - labels: Sequence[Label] | None = ..., - retbins: Literal[False] = ..., - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + right: bool = True, + labels: Sequence[Label] | None = None, + retbins: Literal[False] = False, + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Categorical: ... @overload def qcut( @@ -227,19 +227,19 @@ def qcut( def qcut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], q: int | Sequence[float] | Series[float] | Index[float] | npt.NDArray, - labels: Sequence[Label] | None = ..., - retbins: Literal[False] = ..., - precision: int = ..., - duplicates: Literal["raise", "drop"] = ..., + labels: Sequence[Label] | None = None, + retbins: Literal[False] = False, + precision: int = 3, + duplicates: Literal["raise", "drop"] = "raise", ) -> Categorical: ... @overload def qcut( x: Series, q: int | Sequence[float] | Series[float] | Index[float] | npt.NDArray, - labels: Literal[False] | Sequence[Label] | None = ..., - retbins: Literal[False] = ..., - precision: int = ..., - duplicates: Literal["raise", "drop"] = ..., + labels: Literal[False] | Sequence[Label] | None = None, + retbins: Literal[False] = False, + precision: int = 3, + duplicates: Literal["raise", "drop"] = "raise", ) -> Series: ... @overload def qcut( @@ -255,7 +255,7 @@ def qcut( def qcut( x: Series, q: int | Sequence[float] | Series[float] | Index[float] | npt.NDArray, - labels: Literal[False] | Sequence[Label] | None = ..., + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., @@ -265,7 +265,7 @@ def qcut( def qcut( x: Index | npt.NDArray | Sequence[int] | Sequence[float], q: int | Sequence[float] | Series[float] | Index[float] | npt.NDArray, - labels: Sequence[Label] | None = ..., + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = ..., diff --git a/pandas-stubs/core/tools/datetimes.pyi b/pandas-stubs/core/tools/datetimes.pyi index 6d45eef4d..ec3751eb2 100644 --- a/pandas-stubs/core/tools/datetimes.pyi +++ b/pandas-stubs/core/tools/datetimes.pyi @@ -59,41 +59,41 @@ class FulldatetimeDict(YearMonthDayDict, total=False): @overload def to_datetime( arg: DatetimeScalar, - errors: IgnoreRaise = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., + errors: IgnoreRaise = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + unit: str | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> Timestamp: ... @overload def to_datetime( arg: DatetimeScalar, errors: Literal["coerce"], - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + unit: str | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> Timestamp | NaTType: ... @overload def to_datetime( arg: Series | DictConvertible, - errors: RaiseCoerce = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., + errors: RaiseCoerce = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + unit: str | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> TimestampSeries: ... @overload def to_datetime( @@ -107,13 +107,13 @@ def to_datetime( | Index | ExtensionArray ), - errors: RaiseCoerce = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., + errors: RaiseCoerce = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + unit: str | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> DatetimeIndex: ... diff --git a/pandas-stubs/core/tools/numeric.pyi b/pandas-stubs/core/tools/numeric.pyi index e6eea93bc..5a7e09f16 100644 --- a/pandas-stubs/core/tools/numeric.pyi +++ b/pandas-stubs/core/tools/numeric.pyi @@ -20,21 +20,21 @@ _Downcast: TypeAlias = Literal["integer", "signed", "unsigned", "float"] | None @overload def to_numeric( arg: Scalar, - errors: Literal["raise", "coerce"] = ..., - downcast: _Downcast = ..., + errors: Literal["raise", "coerce"] = "raise", + downcast: _Downcast = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> float: ... @overload def to_numeric( arg: list | tuple | np.ndarray, - errors: RaiseCoerce = ..., - downcast: _Downcast = ..., + errors: RaiseCoerce = "raise", + downcast: _Downcast = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> npt.NDArray: ... @overload def to_numeric( arg: pd.Series, - errors: RaiseCoerce = ..., - downcast: _Downcast = ..., + errors: RaiseCoerce = "raise", + downcast: _Downcast = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> pd.Series: ... diff --git a/pandas-stubs/core/tools/timedeltas.pyi b/pandas-stubs/core/tools/timedeltas.pyi index 38ed0c074..c7d92db61 100644 --- a/pandas-stubs/core/tools/timedeltas.pyi +++ b/pandas-stubs/core/tools/timedeltas.pyi @@ -20,14 +20,14 @@ from pandas._typing import ( @overload def to_timedelta( arg: str | float | timedelta, - unit: TimeDeltaUnitChoices | None = ..., - errors: RaiseCoerce = ..., + unit: TimeDeltaUnitChoices | None = None, + errors: RaiseCoerce = "raise", ) -> Timedelta: ... @overload def to_timedelta( arg: Series, - unit: TimeDeltaUnitChoices | None = ..., - errors: RaiseCoerce = ..., + unit: TimeDeltaUnitChoices | None = None, + errors: RaiseCoerce = "raise", ) -> TimedeltaSeries: ... @overload def to_timedelta( @@ -39,6 +39,6 @@ def to_timedelta( | ArrayLike | Index ), - unit: TimeDeltaUnitChoices | None = ..., - errors: RaiseCoerce = ..., + unit: TimeDeltaUnitChoices | None = None, + errors: RaiseCoerce = "raise", ) -> TimedeltaIndex: ... diff --git a/pandas-stubs/io/clipboards.pyi b/pandas-stubs/io/clipboards.pyi index ddb78d03a..b36db4af0 100644 --- a/pandas-stubs/io/clipboards.pyi +++ b/pandas-stubs/io/clipboards.pyi @@ -28,7 +28,7 @@ from pandas.io.parsers import TextFileReader @overload def read_clipboard( - sep: str | None = ..., + sep: str | None = r"\s+", *, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., delimiter: str | None = ..., @@ -87,7 +87,7 @@ def read_clipboard( ) -> TextFileReader: ... @overload def read_clipboard( - sep: str | None = ..., + sep: str | None = r"\s+", *, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., delimiter: str | None = ..., @@ -146,7 +146,7 @@ def read_clipboard( ) -> TextFileReader: ... @overload def read_clipboard( - sep: str | None = ..., + sep: str | None = r"\s+", *, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., delimiter: str | None = ..., diff --git a/pandas-stubs/io/excel/_base.pyi b/pandas-stubs/io/excel/_base.pyi index e370871b4..f4be46d83 100644 --- a/pandas-stubs/io/excel/_base.pyi +++ b/pandas-stubs/io/excel/_base.pyi @@ -176,7 +176,7 @@ def read_excel( | OpenDocument | pyxlsb.workbook.Workbook ), - sheet_name: int | str = ..., + sheet_name: int | str = 0, *, header: int | Sequence[int] | None = ..., names: ListLikeHashable | None = ..., diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 28f0f8575..7d6150fd6 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -32,8 +32,8 @@ Term = PyTablesExpr @overload def read_hdf( path_or_buf: FilePath | HDFStore, - key: Any | None = ..., - mode: Literal["r", "r+", "a"] = ..., + key: Any | None = None, + mode: Literal["r", "r+", "a"] = "r", errors: Literal[ "strict", "ignore", @@ -42,11 +42,11 @@ def read_hdf( "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., + ] = "strict", + where: str | Term | Sequence[Term] | None = None, + start: int | None = None, + stop: int | None = None, + columns: list[HashableT] | None = None, *, iterator: Literal[True], chunksize: int | None = ..., @@ -55,8 +55,8 @@ def read_hdf( @overload def read_hdf( path_or_buf: FilePath | HDFStore, - key: Any | None = ..., - mode: Literal["r", "r+", "a"] = ..., + key: Any | None = None, + mode: Literal["r", "r+", "a"] = "r", errors: Literal[ "strict", "ignore", @@ -65,12 +65,12 @@ def read_hdf( "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., - iterator: bool = ..., + ] = "strict", + where: str | Term | Sequence[Term] | None = None, + start: int | None = None, + stop: int | None = None, + columns: list[HashableT] | None = None, + iterator: bool = False, *, chunksize: int, **kwargs: Any, @@ -78,8 +78,8 @@ def read_hdf( @overload def read_hdf( path_or_buf: FilePath | HDFStore, - key: Any | None = ..., - mode: Literal["r", "r+", "a"] = ..., + key: Any | None = None, + mode: Literal["r", "r+", "a"] = "r", errors: Literal[ "strict", "ignore", @@ -88,13 +88,13 @@ def read_hdf( "xmlcharrefreplace", "backslashreplace", "namereplace", - ] = ..., - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., - iterator: Literal[False] = ..., - chunksize: None = ..., + ] = "strict", + where: str | Term | Sequence[Term] | None = None, + start: int | None = None, + stop: int | None = None, + columns: list[HashableT] | None = None, + iterator: Literal[False] = False, + chunksize: None = None, **kwargs: Any, ) -> DataFrame | Series: ... diff --git a/pandas-stubs/io/sql.pyi b/pandas-stubs/io/sql.pyi index 49ea7b0e3..3b376b907 100644 --- a/pandas-stubs/io/sql.pyi +++ b/pandas-stubs/io/sql.pyi @@ -40,11 +40,11 @@ _SQLStatement: TypeAlias = ( def read_sql_table( table_name: str, con: _SQLConnection, - schema: str | None = ..., - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., - columns: list[str] | None = ..., + schema: str | None = None, + index_col: str | list[str] | None = None, + coerce_float: bool = True, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, + columns: list[str] | None = None, *, chunksize: int, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., @@ -53,20 +53,20 @@ def read_sql_table( def read_sql_table( table_name: str, con: _SQLConnection, - schema: str | None = ..., - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., - columns: list[str] | None = ..., - chunksize: None = ..., + schema: str | None = None, + index_col: str | list[str] | None = None, + coerce_float: bool = True, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, + columns: list[str] | None = None, + chunksize: None = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> DataFrame: ... @overload def read_sql_query( sql: _SQLStatement, con: _SQLConnection, - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., + index_col: str | list[str] | None = None, + coerce_float: bool = True, params: ( list[Scalar] | tuple[Scalar, ...] @@ -74,8 +74,8 @@ def read_sql_query( | Mapping[str, Scalar] | Mapping[str, tuple[Scalar, ...]] | None - ) = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., + ) = None, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, *, chunksize: int, dtype: DtypeArg | None = ..., @@ -85,8 +85,8 @@ def read_sql_query( def read_sql_query( sql: _SQLStatement, con: _SQLConnection, - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., + index_col: str | list[str] | None = None, + coerce_float: bool = True, params: ( list[Scalar] | tuple[Scalar, ...] @@ -94,18 +94,18 @@ def read_sql_query( | Mapping[str, Scalar] | Mapping[str, tuple[Scalar, ...]] | None - ) = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., - chunksize: None = ..., - dtype: DtypeArg | None = ..., + ) = None, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, + chunksize: None = None, + dtype: DtypeArg | None = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> DataFrame: ... @overload def read_sql( sql: _SQLStatement, con: _SQLConnection, - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., + index_col: str | list[str] | None = None, + coerce_float: bool = True, params: ( list[Scalar] | tuple[Scalar, ...] @@ -113,9 +113,9 @@ def read_sql( | Mapping[str, Scalar] | Mapping[str, tuple[Scalar, ...]] | None - ) = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., - columns: list[str] | None = ..., + ) = None, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, + columns: list[str] | None = None, *, chunksize: int, dtype: DtypeArg | None = ..., @@ -125,8 +125,8 @@ def read_sql( def read_sql( sql: _SQLStatement, con: _SQLConnection, - index_col: str | list[str] | None = ..., - coerce_float: bool = ..., + index_col: str | list[str] | None = None, + coerce_float: bool = True, params: ( list[Scalar] | tuple[Scalar, ...] @@ -134,11 +134,11 @@ def read_sql( | Mapping[str, Scalar] | Mapping[str, tuple[Scalar, ...]] | None - ) = ..., - parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = ..., - columns: list[str] | None = ..., - chunksize: None = ..., - dtype: DtypeArg | None = ..., + ) = None, + parse_dates: list[str] | dict[str, str] | dict[str, dict[str, Any]] | None = None, + columns: list[str] | None = None, + chunksize: None = None, + dtype: DtypeArg | None = None, dtype_backend: DtypeBackend | _NoDefaultDoNotUse = ..., ) -> DataFrame: ... diff --git a/pandas-stubs/plotting/_core.pyi b/pandas-stubs/plotting/_core.pyi index df3237fa2..3db959ddb 100644 --- a/pandas-stubs/plotting/_core.pyi +++ b/pandas-stubs/plotting/_core.pyi @@ -42,28 +42,28 @@ _PlotAccessorColor: TypeAlias = str | list[_SingleColor] | dict[HashableT, _Sing @overload def boxplot( data: DataFrame, - column: Hashable | list[HashableT1] | None = ..., - by: Hashable | list[HashableT2] | None = ..., - ax: Axes | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., - return_type: Literal["axes"] | None = ..., + column: Hashable | list[HashableT1] | None = None, + by: Hashable | list[HashableT2] | None = None, + ax: Axes | 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"] | None = None, **kwargs, ) -> Axes: ... @overload def boxplot( data: DataFrame, - column: Hashable | list[HashableT1] | None = ..., - by: Hashable | list[HashableT2] | None = ..., - ax: Axes | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., + column: Hashable | list[HashableT1] | None = None, + by: Hashable | list[HashableT2] | None = None, + ax: Axes | 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["dict"], **kwargs, @@ -71,14 +71,14 @@ def boxplot( @overload def boxplot( data: DataFrame, - column: Hashable | list[HashableT1] | None = ..., - by: Hashable | list[HashableT2] | None = ..., - ax: Axes | None = ..., - fontsize: float | str | None = ..., - rot: float = ..., - grid: bool = ..., - figsize: tuple[float, float] | None = ..., - layout: tuple[int, int] | None = ..., + column: Hashable | list[HashableT1] | None = None, + by: Hashable | list[HashableT2] | None = None, + ax: Axes | 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["both"], **kwargs,