diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index 6342a9248..21e9dc1cb 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -26,6 +26,7 @@ from pandas.arrays import ( ) from pandas.core.arrays.base import ExtensionArray +from pandas._libs.lib import _NoDefaultDoNotUse from pandas._typing import ( AnyArrayLike, T, @@ -101,19 +102,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_exact: bool = ..., - check_datetimelike_compat: bool = ..., - check_categorical: bool = ..., - check_category_order: 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_series_type: bool = True, + check_names: bool = True, + check_exact: bool | _NoDefaultDoNotUse = ..., + check_datetimelike_compat: bool = False, + check_categorical: bool = True, + check_category_order: bool = True, + check_freq: bool = True, + check_flags: bool = True, + rtol: float | _NoDefaultDoNotUse = ..., + atol: float | _NoDefaultDoNotUse = ..., + obj: str = "Series", *, check_index: Literal[False], check_like: Literal[False] = False, @@ -122,22 +123,22 @@ 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_exact: bool = ..., - check_datetimelike_compat: bool = ..., - check_categorical: bool = ..., - check_category_order: 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_series_type: bool = True, + check_names: bool = True, + check_exact: bool | _NoDefaultDoNotUse = ..., + check_datetimelike_compat: bool = False, + check_categorical: bool = True, + check_category_order: bool = True, + check_freq: bool = True, + check_flags: bool = True, + rtol: float | _NoDefaultDoNotUse = ..., + atol: float | _NoDefaultDoNotUse = ..., + obj: str = "Series", *, check_index: Literal[True] = True, - check_like: bool = ..., + check_like: bool = False, ) -> None: ... def assert_frame_equal( left: DataFrame, diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index b2dc73cb4..8a0dcf1bb 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -69,23 +69,23 @@ def unique(values: T_EXTENSION_ARRAY) -> T_EXTENSION_ARRAY: ... @overload def factorize( values: npt.NDArray[GenericT], - 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_1darray_int64, np_1darray[GenericT]]: ... @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_1darray_int64, 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_1darray_int64, Categorical]: ... def take( arr: np_ndarray[Any] | ExtensionArray | Index | Series, diff --git a/pandas-stubs/core/computation/eval.pyi b/pandas-stubs/core/computation/eval.pyi index 2dd492510..25392ce89 100644 --- a/pandas-stubs/core/computation/eval.pyi +++ b/pandas-stubs/core/computation/eval.pyi @@ -21,7 +21,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: MutableSequence[Mapping[Any, Any]] | None = ..., diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index ff5c5456e..ed5c0ce71 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -324,48 +324,48 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): def boxplot( self, subplots: Literal[True] = 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 = ..., + 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: Any, ) -> 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: Any, ) -> 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: Any, ) -> PlotAxes | Series: ... # Series[PlotAxes] @overload diff --git a/pandas-stubs/core/indexes/datetimes.pyi b/pandas-stubs/core/indexes/datetimes.pyi index f42f9f0e6..516e89c02 100644 --- a/pandas-stubs/core/indexes/datetimes.pyi +++ b/pandas-stubs/core/indexes/datetimes.pyi @@ -11,11 +11,13 @@ from datetime import ( import sys from typing import ( Any, + Literal, final, overload, ) import numpy as np +import pandas as pd from pandas.core.frame import DataFrame from pandas.core.indexes.accessors import DatetimeIndexProperties from pandas.core.indexes.base import Index @@ -31,13 +33,13 @@ from pandas._libs.tslibs.timestamps import Timestamp from pandas._typing import ( AxesData, DateAndDatetimeLike, - Dtype, Frequency, IntervalClosedType, TimeUnit, TimeZones, np_1darray_intp, np_ndarray, + np_ndarray_bool, np_ndarray_dt, np_ndarray_td, ) @@ -54,12 +56,12 @@ class DatetimeIndex( data: AxesData, freq: Frequency = ..., tz: TimeZones = ..., - ambiguous: str = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - dtype: Dtype = ..., - copy: bool = ..., - name: Hashable = ..., + ambiguous: Literal["infer", "NaT", "raise"] | np_ndarray_bool = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + dtype: np.dtype[np.datetime64] | pd.DatetimeTZDtype | str | None = None, + copy: bool = False, + name: Hashable = None, ) -> Self: ... # various ignores needed for mypy, as we do want to restrict what can be used in @@ -123,7 +125,7 @@ def date_range( freq: Frequency | timedelta | None = None, tz: TimeZones = None, normalize: bool = False, - name: Hashable | None = None, + name: Hashable = None, inclusive: IntervalClosedType = "both", unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @@ -134,7 +136,7 @@ def date_range( periods: int, tz: TimeZones = None, normalize: bool = False, - name: Hashable | None = None, + name: Hashable = None, inclusive: IntervalClosedType = "both", unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @@ -146,7 +148,7 @@ def date_range( freq: Frequency | timedelta | None = None, tz: TimeZones = None, normalize: bool = False, - name: Hashable | None = None, + name: Hashable = None, inclusive: IntervalClosedType = "both", unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @@ -158,34 +160,34 @@ def date_range( freq: Frequency | timedelta | None = None, tz: TimeZones = None, normalize: bool = False, - name: Hashable | None = None, + name: Hashable = None, inclusive: IntervalClosedType = "both", unit: TimeUnit | None = None, ) -> DatetimeIndex: ... @overload def bdate_range( - start: str | DateAndDatetimeLike | None = ..., - end: str | DateAndDatetimeLike | None = ..., - periods: int | None = ..., - freq: Frequency | timedelta = ..., - tz: TimeZones = ..., - normalize: bool = ..., - name: Hashable | None = ..., - weekmask: str | None = ..., + start: str | DateAndDatetimeLike | None = None, + end: str | DateAndDatetimeLike | None = None, + periods: int | None = None, + freq: Frequency | timedelta = "B", + tz: TimeZones = None, + normalize: bool = False, + name: Hashable = None, + weekmask: str | None = None, holidays: None = None, - inclusive: IntervalClosedType = ..., + 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: Frequency | timedelta, - tz: TimeZones = ..., - normalize: bool = ..., - name: Hashable | None = ..., - weekmask: str | None = ..., + tz: TimeZones = None, + normalize: bool = False, + name: Hashable = None, + weekmask: str | None = None, holidays: Sequence[str | DateAndDatetimeLike], - inclusive: IntervalClosedType = ..., + inclusive: IntervalClosedType = "both", ) -> DatetimeIndex: ... diff --git a/pandas-stubs/core/reshape/merge.pyi b/pandas-stubs/core/reshape/merge.pyi index 96b7a70dc..35f76c259 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 = ..., - suffixes: Suffixes = ..., - how: JoinHow = ..., + 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 = ("_x", "_y"), + 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 = ..., + 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 = ..., + fill_method: Literal["ffill"] | None = None, suffixes: ( list[str | None] | tuple[str, str] | tuple[None, str] | tuple[str, None] - ) = ..., - how: JoinHow = ..., + ) = ("_x", "_y"), + 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 = ..., + 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 = ..., - suffixes: Suffixes = ..., - how: JoinHow = ..., + fill_method: Literal["ffill"] | None = None, + suffixes: Suffixes = ("_x", "_y"), + how: JoinHow = "outer", ) -> DataFrame: ... def merge_asof( left: DataFrame | Series, @@ -86,7 +86,7 @@ def merge_asof( by: Label | list[HashableT] | None = None, left_by: Label | list[HashableT] | None = None, right_by: Label | list[HashableT] | None = None, - suffixes: Suffixes = ..., + suffixes: Suffixes = ("_x", "_y"), tolerance: int | timedelta | Timedelta | None = None, allow_exact_matches: bool = True, direction: Literal["backward", "forward", "nearest"] = "backward", diff --git a/pandas-stubs/core/reshape/pivot.pyi b/pandas-stubs/core/reshape/pivot.pyi index 7567ae385..945e912e6 100644 --- a/pandas-stubs/core/reshape/pivot.pyi +++ b/pandas-stubs/core/reshape/pivot.pyi @@ -121,25 +121,25 @@ def crosstab( index: _Values | list[_Values], columns: _Values | list[_Values], values: _Values, - rownames: SequenceNotStr[Hashable] | None = ..., - colnames: SequenceNotStr[Hashable] | None = ..., + rownames: SequenceNotStr[Hashable] | None = None, + colnames: SequenceNotStr[Hashable] | None = None, *, aggfunc: str | np.ufunc | Callable[[Series], float], - margins: bool = ..., - margins_name: str = ..., - dropna: bool = ..., - normalize: bool | Literal[0, 1, "all", "index", "columns"] = ..., + margins: bool = False, + margins_name: str = "All", + dropna: bool = True, + normalize: bool | Literal[0, 1, "all", "index", "columns"] = False, ) -> DataFrame: ... @overload def crosstab( index: _Values | list[_Values], columns: _Values | list[_Values], values: None = None, - rownames: SequenceNotStr[Hashable] | None = ..., - colnames: SequenceNotStr[Hashable] | None = ..., + rownames: SequenceNotStr[Hashable] | None = None, + colnames: SequenceNotStr[Hashable] | None = None, aggfunc: None = None, - margins: bool = ..., - margins_name: str = ..., - dropna: bool = ..., - normalize: bool | Literal[0, 1, "all", "index", "columns"] = ..., + 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 9f237fd64..60fbdd711 100644 --- a/pandas-stubs/core/reshape/tile.pyi +++ b/pandas-stubs/core/reshape/tile.pyi @@ -29,118 +29,118 @@ from pandas._typing import ( def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: int | Index[int] | Index[float] | Sequence[float] | Series, - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[np_1darray_intp, np_1darray_float]: ... @overload def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: IntervalIndex[IntervalT], - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[np_1darray_intp, IntervalIndex[IntervalT]]: ... @overload def cut( # pyright: ignore[reportOverlappingOverload] x: Series[Timestamp], bins: int | Series[Timestamp] | DatetimeIndex | Sequence[np.datetime64 | Timestamp], - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Series, DatetimeIndex]: ... @overload def cut( x: Series[Timestamp], bins: IntervalIndex[Interval[Timestamp]], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Series, DatetimeIndex]: ... @overload def cut( x: Series, bins: int | Index[int] | Index[float] | Sequence[float] | Series, - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Series, np_1darray_float]: ... @overload 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 = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Series, IntervalIndex]: ... @overload def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: int | Index[int] | Index[float] | Sequence[float] | Series, - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Categorical, np_1darray_float]: ... @overload def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: IntervalIndex[IntervalT], - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, *, retbins: Literal[True], - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> tuple[Categorical, IntervalIndex[IntervalT]]: ... @overload def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: int | Sequence[float] | Index[int] | Index[float] | IntervalIndex | Series, - right: bool = ..., + right: bool = True, *, labels: Literal[False], retbins: Literal[False] = False, - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> np_1darray_intp: ... @overload def cut( @@ -152,37 +152,37 @@ def cut( | DatetimeIndex | Series[Timestamp] ), - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, retbins: Literal[False] = False, - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Series[CategoricalDtype]: ... @overload def cut( x: Series, bins: int | Sequence[float] | Index[int] | Index[float] | IntervalIndex | Series, - right: bool = ..., - labels: Literal[False] | Sequence[Label] | None = ..., + right: bool = True, + labels: Literal[False] | Sequence[Label] | None = None, retbins: Literal[False] = False, - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Series: ... @overload def cut( x: Sequence[float] | np_ndarray_anyint | np_ndarray_float | Index, bins: int | Sequence[float] | Index[int] | Index[float] | IntervalIndex | Series, - right: bool = ..., - labels: Sequence[Label] | None = ..., + right: bool = True, + labels: Sequence[Label] | None = None, retbins: Literal[False] = False, - precision: int = ..., - include_lowest: bool = ..., - duplicates: Literal["raise", "drop"] = ..., - ordered: bool = ..., + precision: int = 3, + include_lowest: bool = False, + duplicates: Literal["raise", "drop"] = "raise", + ordered: bool = True, ) -> Categorical: ... @overload def qcut( @@ -206,7 +206,7 @@ def qcut( def qcut( x: Series, q: int | Sequence[float] | np_ndarray_float | Index[float] | Series[float], - labels: Literal[False] | Sequence[Label] | None = ..., + labels: Literal[False] | Sequence[Label] | None = None, retbins: Literal[False] = False, precision: int = 3, duplicates: Literal["raise", "drop"] = "raise", @@ -231,7 +231,7 @@ def qcut( def qcut( x: Series[int] | Series[float], q: int | Sequence[float] | np_ndarray_float | Index[float] | Series[float], - labels: Literal[False] | Sequence[Label] | None = ..., + labels: Literal[False] | Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = 3, @@ -247,7 +247,7 @@ def qcut( | Index[float] ), q: int | Sequence[float] | np_ndarray_float | Index[float] | Series[float], - labels: Sequence[Label] | None = ..., + labels: Sequence[Label] | None = None, *, retbins: Literal[True], precision: int = 3, diff --git a/pandas-stubs/core/tools/datetimes.pyi b/pandas-stubs/core/tools/datetimes.pyi index 61453771f..bbcead879 100644 --- a/pandas-stubs/core/tools/datetimes.pyi +++ b/pandas-stubs/core/tools/datetimes.pyi @@ -24,7 +24,6 @@ from pandas._libs.tslibs import NaTType from pandas._typing import ( AnyArrayLike, DictConvertible, - IgnoreRaise, RaiseCoerce, TimestampConvertibleTypes, np_ndarray_dt, @@ -61,41 +60,41 @@ class FulldatetimeDict(YearMonthDayDict, total=False): @overload def to_datetime( arg: DatetimeScalar, - errors: IgnoreRaise = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., - exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + errors: Literal["raise"] = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, + exact: bool = True, + unit: Literal["D", "s", "ms", "us", "ns"] | 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 = ..., - exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, + exact: bool = True, + unit: Literal["D", "s", "ms", "us", "ns"] | 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 = ..., - exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + errors: RaiseCoerce = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, + exact: bool = True, + unit: Literal["D", "s", "ms", "us", "ns"] | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> Series[Timestamp]: ... @overload def to_datetime( @@ -109,13 +108,13 @@ def to_datetime( | Index | ExtensionArray ), - errors: RaiseCoerce = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool = ..., - format: str | None = ..., - exact: bool = ..., - unit: str | None = ..., - origin: Literal["julian", "unix"] | TimestampConvertibleTypes = ..., - cache: bool = ..., + errors: RaiseCoerce = "raise", + dayfirst: bool = False, + yearfirst: bool = False, + utc: bool = False, + format: str | None = None, + exact: bool = True, + unit: Literal["D", "s", "ms", "us", "ns"] | None = None, + origin: Literal["julian", "unix"] | TimestampConvertibleTypes = "unix", + cache: bool = True, ) -> DatetimeIndex: ... diff --git a/pandas-stubs/core/tools/timedeltas.pyi b/pandas-stubs/core/tools/timedeltas.pyi index 895e7cfc2..5e8837c52 100644 --- a/pandas-stubs/core/tools/timedeltas.pyi +++ b/pandas-stubs/core/tools/timedeltas.pyi @@ -16,18 +16,18 @@ 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", ) -> Series[Timedelta]: ... @overload def to_timedelta( arg: SequenceNotStr[str | float | timedelta] | range | ArrayLike | Index, - unit: TimeDeltaUnitChoices | None = ..., - errors: RaiseCoerce = ..., + unit: TimeDeltaUnitChoices | None = None, + errors: RaiseCoerce = "raise", ) -> TimedeltaIndex: ...