diff --git a/pandas-stubs/_libs/tslibs/timedeltas.pyi b/pandas-stubs/_libs/tslibs/timedeltas.pyi index 562ba551d..6bc82a9e4 100644 --- a/pandas-stubs/_libs/tslibs/timedeltas.pyi +++ b/pandas-stubs/_libs/tslibs/timedeltas.pyi @@ -100,7 +100,7 @@ class Timedelta(timedelta): def __new__( cls, value: str | float | Timedelta | Tick | timedelta | np.timedelta64 = ..., - unit: TimeDeltaUnitChoices = ..., + unit: TimeDeltaUnitChoices = "ns", *, days: float | np.integer | np.floating = ..., seconds: float | np.integer | np.floating = ..., @@ -340,7 +340,7 @@ class Timedelta(timedelta): def to_numpy(self) -> np.timedelta64: ... @property def components(self) -> Components: ... - def view(self, dtype: npt.DTypeLike = ...) -> object: ... + def view(self, dtype: npt.DTypeLike) -> object: ... @property def unit(self) -> TimeUnit: ... 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 2732c6457..e9354812a 100644 --- a/pandas-stubs/_libs/tslibs/timestamps.pyi +++ b/pandas-stubs/_libs/tslibs/timestamps.pyi @@ -60,19 +60,19 @@ class Timestamp(datetime, SupportsIndex): def __new__( cls, ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ..., - year: int | None = ..., - month: int | None = ..., - day: int | None = ..., - hour: int | None = ..., - minute: int | None = ..., - second: int | None = ..., - microsecond: int | None = ..., - tzinfo: _tzinfo | None = ..., + year: int | None = None, + month: int | None = None, + day: int | None = None, + hour: int | None = None, + minute: int | None = None, + second: int | None = None, + microsecond: int | None = None, + tzinfo: _tzinfo | None = None, *, - nanosecond: int | None = ..., - tz: TimeZones = ..., - unit: str | int | None = ..., - fold: Literal[0, 1] | None = ..., + nanosecond: int | None = None, + tz: TimeZones = None, + unit: str | int | None = None, + fold: Literal[0, 1] | None = None, ) -> Self: ... # GH 46171 # While Timestamp can return pd.NaT, having the constructor return @@ -102,11 +102,11 @@ class Timestamp(datetime, SupportsIndex): if sys.version_info >= (3, 12): @classmethod def fromtimestamp( # pyright: ignore[reportIncompatibleMethodOverride] - cls, t: float, tz: _tzinfo | str | None = ... + cls, t: float, tz: _tzinfo | str | None = None ) -> Self: ... else: @classmethod - def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ... + def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = None) -> Self: ... @classmethod def today(cls, tz: _tzinfo | str | None = None) -> Self: ... @@ -114,7 +114,7 @@ class Timestamp(datetime, SupportsIndex): def fromordinal( cls, ordinal: int, - tz: _tzinfo | str | None = ..., + tz: _tzinfo | str | None = None, ) -> Self: ... @classmethod def now(cls, tz: _tzinfo | str | None = None) -> Self: ... @@ -137,17 +137,17 @@ class Timestamp(datetime, SupportsIndex): # Violation of Liskov substitution principle def replace( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore # ty: ignore[invalid-method-override] self, - year: int | None = ..., - month: int | None = ..., - day: int | None = ..., - hour: int | None = ..., - minute: int | None = ..., - second: int | None = ..., - microsecond: int | None = ..., - tzinfo: _tzinfo | None = ..., - fold: Literal[0, 1] | None = ..., + year: int | None = None, + month: int | None = None, + day: int | None = None, + hour: int | None = None, + minute: int | None = None, + second: int | None = None, + microsecond: int | None = None, + tzinfo: _tzinfo | None = None, + fold: Literal[0, 1] | None = None, ) -> Timestamp: ... - def astimezone(self, tz: _tzinfo | None = ...) -> Self: ... + def astimezone(self, tz: _tzinfo | None = None) -> Self: ... def ctime(self) -> str: ... def isoformat( # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore[bad-override] # ty: ignore[invalid-method-override] self, @@ -261,9 +261,9 @@ class Timestamp(datetime, SupportsIndex): def is_quarter_end(self) -> bool: ... @property def is_year_end(self) -> bool: ... - def to_pydatetime(self, warn: bool = ...) -> datetime: ... + def to_pydatetime(self, warn: bool = True) -> datetime: ... def to_datetime64(self) -> np.datetime64: ... - def to_period(self, freq: PeriodFrequency | None = ...) -> Period: ... + def to_period(self, freq: PeriodFrequency | None = None) -> Period: ... def to_julian_date(self) -> np.float64: ... @property def asm8(self) -> np.datetime64: ... diff --git a/pandas-stubs/core/arrays/timedeltas.pyi b/pandas-stubs/core/arrays/timedeltas.pyi index 446cc47e3..9fbcd003a 100644 --- a/pandas-stubs/core/arrays/timedeltas.pyi +++ b/pandas-stubs/core/arrays/timedeltas.pyi @@ -13,6 +13,7 @@ from pandas._libs.tslibs.offsets import DateOffset from pandas._libs.tslibs.timedeltas import Timedelta from pandas._typing import ( AnyArrayLike, + AxisInt, DtypeArg, Frequency, NpDtype, @@ -34,37 +35,27 @@ class TimedeltaArray(TimelikeOps): freq: Frequency | None = None, copy: bool = ..., ) -> None: ... - # TODO: pandas-dev/pandas-stubs#1589 add testing to figure out the correct types - # def sum( - # self, - # *, - # axis=..., - # dtype=..., - # out=..., - # keepdims: bool = ..., - # initial=..., - # skipna: bool = ..., - # min_count: int = ..., - # ): ... - # def std( - # self, - # *, - # axis=..., - # dtype=..., - # out=..., - # ddof: int = ..., - # keepdims: bool = ..., - # skipna: bool = ..., - # ): ... - # def median( - # self, - # *, - # axis=..., - # out=..., - # overwrite_input: bool = ..., - # keepdims: bool = ..., - # skipna: bool = ..., - # ): ... + def sum( + self, + *, + axis: AxisInt | None = None, + dtype: NpDtype | None = None, + out: np_1darray_object | None = None, + keepdims: bool = False, + initial: object | None = None, + skipna: bool = True, + min_count: int = 0, + ) -> Timedelta: ... + def std( + self, + *, + axis: AxisInt | None = None, + dtype: DtypeArg | None = None, + out: np_1darray_object | None = None, + ddof: int = 1, + keepdims: bool = False, + skipna: bool = True, + ) -> Timedelta: ... def __mul__(self, other: Any) -> Self: ... __rmul__ = __mul__ @overload @@ -123,7 +114,7 @@ class TimedeltaArray(TimelikeOps): def min(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... def max(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... def mean(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... - def median(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta | NaTType: ... + def median(self, *, skipna: bool = True, **kwargs: Any) -> Timedelta: ... def __array__( self, dtype: NpDtype | None = None, copy: bool | None = None ) -> np_1darray_td: ... diff --git a/pandas-stubs/io/json/_json.pyi b/pandas-stubs/io/json/_json.pyi index 1c5e3d22c..fa549e77d 100644 --- a/pandas-stubs/io/json/_json.pyi +++ b/pandas-stubs/io/json/_json.pyi @@ -32,49 +32,49 @@ from pandas._typing import ( def read_json( path_or_buf: FilePath | ReadBuffer[str] | ReadBuffer[bytes], *, - orient: JsonSeriesOrient | None = ..., + orient: JsonSeriesOrient | None = None, typ: Literal["series"], - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = None, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: int, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., - engine: Literal["ujson"] = ..., + engine: Literal["ujson"] = "ujson", ) -> JsonReader[Series]: ... @overload def read_json( path_or_buf: FilePath | ReadBuffer[bytes], *, - orient: JsonSeriesOrient | None = ..., + orient: JsonSeriesOrient | None = None, typ: Literal["series"], - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = None, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: int, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., engine: Literal["pyarrow"], ) -> JsonReader[Series]: ... @@ -82,49 +82,49 @@ def read_json( def read_json( path_or_buf: FilePath | ReadBuffer[bytes], *, - orient: JsonFrameOrient | None = ..., - typ: Literal["frame"] = ..., - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + orient: JsonFrameOrient | None = None, + typ: Literal["frame"] = "frame", + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = None, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: int, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., - engine: Literal["ujson"] = ..., + engine: Literal["ujson"] = "ujson", ) -> JsonReader[DataFrame]: ... @overload def read_json( path_or_buf: FilePath | ReadBuffer[bytes], *, - orient: JsonFrameOrient | None = ..., - typ: Literal["frame"] = ..., - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + orient: JsonFrameOrient | None = None, + typ: Literal["frame"] = "frame", + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = None, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: int, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., engine: Literal["pyarrow"], ) -> JsonReader[DataFrame]: ... @@ -132,49 +132,49 @@ def read_json( def read_json( path_or_buf: FilePath | ReadBuffer[str] | ReadBuffer[bytes], *, - orient: JsonSeriesOrient | None = ..., + orient: JsonSeriesOrient | None = None, typ: Literal["series"], - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = None, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., - lines: bool = ..., + ) = "strict", + lines: bool = False, chunksize: None = None, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., - engine: Literal["ujson"] = ..., + engine: Literal["ujson"] = "ujson", ) -> Series: ... @overload def read_json( path_or_buf: FilePath | ReadBuffer[bytes], *, - orient: JsonSeriesOrient | None = ..., + orient: JsonSeriesOrient | None = None, typ: Literal["series"], - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = False, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: None = None, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., engine: Literal["pyarrow"], ) -> Series: ... @@ -182,49 +182,49 @@ def read_json( def read_json( path_or_buf: FilePath | ReadBuffer[str] | ReadBuffer[bytes], *, - orient: JsonFrameOrient | None = ..., - typ: Literal["frame"] = ..., - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + orient: JsonFrameOrient | None = None, + typ: Literal["frame"] = "frame", + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = False, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., - lines: bool = ..., + ) = "strict", + lines: bool = False, chunksize: None = None, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., - engine: Literal["ujson"] = ..., + engine: Literal["ujson"] = "ujson", ) -> DataFrame: ... @overload def read_json( path_or_buf: FilePath | ReadBuffer[bytes], *, - orient: JsonFrameOrient | None = ..., - typ: Literal["frame"] = ..., - dtype: bool | Mapping[HashableT, DtypeArg] | None = ..., - convert_axes: bool | None = ..., - convert_dates: bool | list[str] = ..., - keep_default_dates: bool = ..., - precise_float: bool = ..., - date_unit: TimeUnit | None = ..., - encoding: str | None = ..., + orient: JsonFrameOrient | None = None, + typ: Literal["frame"] = "frame", + dtype: bool | Mapping[HashableT, DtypeArg] | None = None, + convert_axes: bool | None = False, + convert_dates: bool | list[str] = True, + keep_default_dates: bool = True, + precise_float: bool = False, + date_unit: TimeUnit | None = None, + encoding: str | None = None, encoding_errors: ( Literal["strict", "ignore", "replace", "backslashreplace", "surrogateescape"] | None - ) = ..., + ) = "strict", lines: Literal[True], chunksize: None = None, - compression: CompressionOptions = ..., - nrows: int | None = ..., - storage_options: StorageOptions = ..., + compression: CompressionOptions = "infer", + nrows: int | None = None, + storage_options: StorageOptions = None, dtype_backend: DtypeBackend | NoDefault = ..., engine: Literal["pyarrow"], ) -> DataFrame: ... diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 501aef494..bb2723a4c 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -33,8 +33,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", @@ -43,21 +43,21 @@ 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 = ..., + chunksize: int | None = None, **kwargs: Any, ) -> TableIterator: ... @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", @@ -66,12 +66,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, @@ -79,8 +79,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", @@ -89,11 +89,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[False] = False, chunksize: None = None, **kwargs: Any, @@ -103,10 +103,10 @@ class HDFStore: def __init__( self, path: FilePath | BaseBuffer, - mode: Literal["a", "w", "r", "r+"] = ..., - complevel: int | None = ..., - complib: HDFCompLib | None = ..., - fletcher32: bool = ..., + mode: Literal["a", "w", "r", "r+"] = "a", + complevel: int | None = None, + complib: HDFCompLib | None = None, + fletcher32: bool = False, **kwargs: Any, ) -> None: ... def __fspath__(self) -> str: ... @@ -133,39 +133,39 @@ class HDFStore: def select( self, key: str, - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., + 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 = ..., - auto_close: bool = ..., + chunksize: int | None = None, + auto_close: bool = False, ) -> TableIterator: ... @overload def select( self, key: str, - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., - iterator: bool = ..., + 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, - auto_close: bool = ..., + auto_close: bool = False, ) -> TableIterator: ... @overload def select( self, key: str, - where: str | Term | Sequence[Term] | None = ..., - start: int | None = ..., - stop: int | None = ..., - columns: list[HashableT] | None = ..., + 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, - auto_close: bool = ..., + auto_close: bool = False, ) -> DataFrame | Series: ... def put( self, diff --git a/pandas-stubs/io/sas/sas7bdat.pyi b/pandas-stubs/io/sas/sas7bdat.pyi index e76513647..0f9ae029f 100644 --- a/pandas-stubs/io/sas/sas7bdat.pyi +++ b/pandas-stubs/io/sas/sas7bdat.pyi @@ -1,8 +1,8 @@ from pandas import DataFrame -from pandas.io.sas.sasreader import ReaderBase +from pandas.io.sas.sasreader import SASReader -class SAS7BDATReader(ReaderBase): +class SAS7BDATReader(SASReader): def close(self) -> None: ... def __next__(self) -> DataFrame: ... def read(self, nrows: int | None = None) -> DataFrame: ... diff --git a/pandas-stubs/io/sas/sas_xport.pyi b/pandas-stubs/io/sas/sas_xport.pyi index 95e1f20cd..a4e5d26e5 100644 --- a/pandas-stubs/io/sas/sas_xport.pyi +++ b/pandas-stubs/io/sas/sas_xport.pyi @@ -1,8 +1,8 @@ import pandas as pd -from pandas.io.sas.sasreader import ReaderBase +from pandas.io.sas.sasreader import SASReader -class XportReader(ReaderBase): +class XportReader(SASReader): def close(self) -> None: ... def __next__(self) -> pd.DataFrame: ... def read(self, nrows: int | None = None) -> pd.DataFrame: ... diff --git a/pandas-stubs/io/sas/sasreader.pyi b/pandas-stubs/io/sas/sasreader.pyi index a50e610eb..4ffb6caef 100644 --- a/pandas-stubs/io/sas/sasreader.pyi +++ b/pandas-stubs/io/sas/sasreader.pyi @@ -1,8 +1,11 @@ from abc import ( - ABCMeta, + ABC, abstractmethod, ) -from collections.abc import Hashable +from collections.abc import ( + Hashable, + Iterator, +) from types import TracebackType from typing import ( Literal, @@ -21,9 +24,9 @@ from pandas._typing import ( from pandas.io.sas.sas7bdat import SAS7BDATReader from pandas.io.sas.sas_xport import XportReader -class ReaderBase(metaclass=ABCMeta): +class SASReader(Iterator[DataFrame], ABC): @abstractmethod - def read(self, nrows: int | None = ...) -> DataFrame: ... + def read(self, nrows: int | None = None) -> DataFrame: ... @abstractmethod def close(self) -> None: ... def __enter__(self) -> Self: ... @@ -39,75 +42,75 @@ def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: Literal["sas7bdat"], - index: Hashable | None = ..., - encoding: str | None = ..., + index: Hashable | None = None, + encoding: str | None = None, chunksize: int, - iterator: bool = ..., - compression: CompressionOptions = ..., + iterator: bool = False, + compression: CompressionOptions = "infer", ) -> SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: Literal["xport"], - index: Hashable | None = ..., - encoding: str | None = ..., + index: Hashable | None = None, + encoding: str | None = None, chunksize: int, - iterator: bool = ..., - compression: CompressionOptions = ..., + iterator: bool = False, + compression: CompressionOptions = "infer", ) -> XportReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: None = None, - index: Hashable | None = ..., - encoding: str | None = ..., + index: Hashable | None = None, + encoding: str | None = None, chunksize: int, - iterator: bool = ..., - compression: CompressionOptions = ..., + iterator: bool = False, + compression: CompressionOptions = "infer", ) -> XportReader | SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: Literal["sas7bdat"], - index: Hashable | None = ..., - encoding: str | None = ..., - chunksize: int | None = ..., + index: Hashable | None = None, + encoding: str | None = None, + chunksize: int | None = None, iterator: Literal[True], - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", ) -> SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: Literal["xport"], - index: Hashable | None = ..., - encoding: str | None = ..., - chunksize: int | None = ..., + index: Hashable | None = None, + encoding: str | None = None, + chunksize: int | None = None, iterator: Literal[True], - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", ) -> XportReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, format: None = None, - index: Hashable | None = ..., - encoding: str | None = ..., - chunksize: int | None = ..., + index: Hashable | None = None, + encoding: str | None = None, + chunksize: int | None = None, iterator: Literal[True], - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", ) -> XportReader | SAS7BDATReader: ... @overload def read_sas( filepath_or_buffer: FilePath | ReadBuffer[bytes], *, - format: Literal["xport", "sas7bdat"] | None = ..., - index: Hashable | None = ..., - encoding: str | None = ..., + format: Literal["xport", "sas7bdat"] | None = None, + index: Hashable | None = None, + encoding: str | None = None, chunksize: None = None, iterator: Literal[False] = False, - compression: CompressionOptions = ..., + compression: CompressionOptions = "infer", ) -> DataFrame: ... diff --git a/pandas-stubs/io/sql.pyi b/pandas-stubs/io/sql.pyi index 3de3a292c..e589c587d 100644 --- a/pandas-stubs/io/sql.pyi +++ b/pandas-stubs/io/sql.pyi @@ -42,11 +42,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 | NoDefault = ..., @@ -55,11 +55,11 @@ 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 = ..., + 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 | NoDefault = ..., ) -> DataFrame: ... @@ -67,8 +67,8 @@ def read_sql_table( 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, ...] @@ -76,19 +76,19 @@ 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 = ..., + dtype: DtypeArg | None = None, dtype_backend: DtypeBackend | NoDefault = ..., ) -> Generator[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, ...] @@ -96,10 +96,10 @@ 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: None = None, - dtype: DtypeArg | None = ..., + dtype: DtypeArg | None = None, dtype_backend: DtypeBackend | NoDefault = ..., ) -> DataFrame: ... @overload @@ -119,7 +119,7 @@ def read_sql( columns: list[str] | None = None, *, chunksize: int, - dtype: DtypeArg | None = ..., + dtype: DtypeArg | None = None, dtype_backend: DtypeBackend | NoDefault = ..., ) -> Generator[DataFrame]: ... @overload @@ -191,12 +191,12 @@ class SQLTable: def create(self) -> None: ... def insert_data(self) -> tuple[list[str], list[np_ndarray]]: ... def insert( - self, chunksize: int | None = ..., method: str | None = ... + self, chunksize: int | None = None, method: str | None = None ) -> int | None: ... def read( self, - coerce_float: bool = ..., - parse_dates: bool | list[str] | None = ..., - columns: list[str] | None = ..., - chunksize: int | None = ..., + coerce_float: bool = True, + parse_dates: bool | list[str] | None = None, + columns: list[str] | None = None, + chunksize: int | None = None, ) -> DataFrame | Generator[DataFrame]: ... diff --git a/pandas-stubs/plotting/_core.pyi b/pandas-stubs/plotting/_core.pyi index 250f996d4..402ffdf9d 100644 --- a/pandas-stubs/plotting/_core.pyi +++ b/pandas-stubs/plotting/_core.pyi @@ -137,37 +137,37 @@ class PlotAccessor: kind: Literal["pie"], ax: Axes | None = None, subplots: Literal[False] | None = False, - sharex: bool = ..., - sharey: bool = ..., - layout: tuple[int, int] = ..., - figsize: tuple[float, float] = ..., + sharex: bool = False, + sharey: bool = False, + layout: tuple[int, int] | None = None, + figsize: tuple[float, float] | None = None, use_index: bool = True, - title: Sequence[str] | None = ..., - grid: bool | None = ..., - legend: bool | Literal["reverse"] = ..., - style: str | list[str] | dict[HashableT1, str] = ..., - logx: bool | Literal["sym"] = ..., - logy: bool | Literal["sym"] = ..., - loglog: bool | Literal["sym"] = ..., - xticks: Sequence[float] = ..., - yticks: Sequence[float] = ..., - xlim: tuple[float, float] | list[float] = ..., - ylim: tuple[float, float] | list[float] = ..., - xlabel: str | None = ..., - ylabel: str | None = ..., - rot: float = ..., - fontsize: float = ..., - colormap: str | Colormap | None = ..., - colorbar: bool = ..., - position: float = ..., - table: bool | Series | DataFrame = ..., - yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - stacked: bool = ..., - secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = ..., - mark_right: bool = ..., - include_bool: bool = ..., - backend: str = ..., + title: Sequence[str] | None = None, + grid: bool | None = None, + legend: bool | Literal["reverse"] = False, + style: str | list[str] | dict[HashableT1, str] | None = None, + logx: bool | Literal["sym"] = False, + logy: bool | Literal["sym"] = False, + loglog: bool | Literal["sym"] = False, + xticks: Sequence[float] | None = None, + yticks: Sequence[float] | None = None, + xlim: tuple[float, float] | list[float] | None = None, + ylim: tuple[float, float] | list[float] | None = None, + xlabel: str | None = None, + ylabel: str | None = None, + rot: float | None = None, + fontsize: float | None = None, + colormap: str | Colormap | None = None, + colorbar: bool = False, + position: float = 0.5, + table: bool | Series | DataFrame = False, + yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + stacked: bool = False, + secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = False, + mark_right: bool = True, + include_bool: bool = False, + backend: str | None = None, **kwargs: Any, ) -> Axes: ... @overload @@ -180,37 +180,37 @@ class PlotAccessor: kind: Literal["hist"], ax: Axes | None = None, subplots: Literal[False] | None = False, - sharex: bool = ..., - sharey: bool = ..., - layout: tuple[int, int] = ..., - figsize: tuple[float, float] = ..., + sharex: bool = False, + sharey: bool = False, + layout: tuple[int, int] | None = None, + figsize: tuple[float, float] | None = None, use_index: bool = True, - title: Sequence[str] | None = ..., - grid: bool | None = ..., - legend: bool | Literal["reverse"] = ..., - style: str | list[str] | dict[HashableT1, str] = ..., - logx: bool | Literal["sym"] = ..., - logy: bool | Literal["sym"] = ..., - loglog: bool | Literal["sym"] = ..., - xticks: Sequence[float] = ..., - yticks: Sequence[float] = ..., - xlim: tuple[float, float] | list[float] = ..., - ylim: tuple[float, float] | list[float] = ..., - xlabel: str | None = ..., - ylabel: str | None = ..., - rot: float = ..., - fontsize: float = ..., - colormap: str | Colormap | None = ..., - colorbar: bool = ..., - position: float = ..., - table: bool | Series | DataFrame = ..., - yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - stacked: bool = ..., - secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = ..., - mark_right: bool = ..., - include_bool: bool = ..., - backend: str = ..., + title: Sequence[str] | None = None, + grid: bool | None = None, + legend: bool | Literal["reverse"] = False, + style: str | list[str] | dict[HashableT1, str] | None = None, + logx: bool | Literal["sym"] = False, + logy: bool | Literal["sym"] = False, + loglog: bool | Literal["sym"] = False, + xticks: Sequence[float] | None = None, + yticks: Sequence[float] | None = None, + xlim: tuple[float, float] | list[float] | None = None, + ylim: tuple[float, float] | list[float] | None = None, + xlabel: str | None = None, + ylabel: str | None = None, + rot: float | None = None, + fontsize: float | None = None, + colormap: str | Colormap | None = None, + colorbar: bool = False, + position: float = 0.5, + table: bool | Series | DataFrame = False, + yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + stacked: bool = False, + secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = False, + mark_right: bool = True, + include_bool: bool = False, + backend: str | None = None, weights: AnyArrayLike | None = None, **kwargs: Any, ) -> Axes: ... @@ -219,8 +219,8 @@ class PlotAccessor: self, *, data: Series | DataFrame | None = ..., - x: Hashable = ..., - y: Hashable | Sequence[Hashable] = ..., + x: Hashable = None, + y: Hashable | Sequence[Hashable] = None, kind: Literal[ "line", "bar", @@ -233,40 +233,40 @@ class PlotAccessor: "pie", "scatter", "hexbin", - ] = ..., - ax: Axes | None = ..., - subplots: Literal[False] | None = ..., - sharex: bool = ..., - sharey: bool = ..., - layout: tuple[int, int] = ..., - figsize: tuple[float, float] = ..., - use_index: bool = ..., - title: Sequence[str] | None = ..., - grid: bool | None = ..., - legend: bool | Literal["reverse"] = ..., - style: str | list[str] | dict[HashableT1, str] = ..., - logx: bool | Literal["sym"] = ..., - logy: bool | Literal["sym"] = ..., - loglog: bool | Literal["sym"] = ..., - xticks: Sequence[float] = ..., - yticks: Sequence[float] = ..., - xlim: tuple[float, float] | list[float] = ..., - ylim: tuple[float, float] | list[float] = ..., - xlabel: str = ..., - ylabel: str = ..., - rot: float = ..., - fontsize: float = ..., - colormap: str | Colormap | None = ..., - colorbar: bool = ..., - position: float = ..., - table: bool | Series | DataFrame = ..., - yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - stacked: bool = ..., - secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = ..., - mark_right: bool = ..., - include_bool: bool = ..., - backend: str = ..., + ] = "line", + ax: Axes | None = None, + subplots: Literal[False] | None = False, + sharex: bool = False, + sharey: bool = False, + layout: tuple[int, int] | None = None, + figsize: tuple[float, float] | None = None, + use_index: bool = True, + title: Sequence[str] | None = None, + grid: bool | None = None, + legend: bool | Literal["reverse"] = False, + style: str | list[str] | dict[HashableT1, str] | None = None, + logx: bool | Literal["sym"] = False, + logy: bool | Literal["sym"] = False, + loglog: bool | Literal["sym"] = False, + xticks: Sequence[float] | None = None, + yticks: Sequence[float] | None = None, + xlim: tuple[float, float] | list[float] | None = None, + ylim: tuple[float, float] | list[float] | None = None, + xlabel: str | None = None, + ylabel: str | None = None, + rot: float | None = None, + fontsize: float | None = None, + colormap: str | Colormap | None = None, + colorbar: bool = False, + position: float = 0.5, + table: bool | Series | DataFrame = False, + yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + stacked: bool = False, + secondary_y: bool | list[HashableT2] | tuple[HashableT2, ...] = False, + mark_right: bool = True, + include_bool: bool = False, + backend: str | None = None, **kwargs: Any, ) -> Axes: ... @overload @@ -274,8 +274,8 @@ class PlotAccessor: self, *, data: Series | DataFrame | None = ..., - x: Hashable = ..., - y: Hashable | Sequence[Hashable] = ..., + x: Hashable = None, + y: Hashable | Sequence[Hashable] = None, kind: Literal[ "line", "bar", @@ -287,40 +287,40 @@ class PlotAccessor: "pie", "scatter", "hexbin", - ] = ..., - ax: Axes | None = ..., + ] = "line", + ax: Axes | None = None, subplots: Literal[True] | Sequence[Iterable[HashableT1]], - sharex: bool = ..., - sharey: bool = ..., - layout: tuple[int, int] = ..., - figsize: tuple[float, float] = ..., - use_index: bool = ..., - title: Sequence[str] | None = ..., - grid: bool | None = ..., - legend: bool | Literal["reverse"] = ..., - style: str | list[str] | dict[HashableT2, str] = ..., - logx: bool | Literal["sym"] = ..., - logy: bool | Literal["sym"] = ..., - loglog: bool | Literal["sym"] = ..., - xticks: Sequence[float] = ..., - yticks: Sequence[float] = ..., - xlim: tuple[float, float] | list[float] = ..., - ylim: tuple[float, float] | list[float] = ..., - xlabel: str = ..., - ylabel: str = ..., - rot: float = ..., - fontsize: float = ..., - colormap: str | Colormap | None = ..., - colorbar: bool = ..., - position: float = ..., - table: bool | Series | DataFrame = ..., - yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - stacked: bool = ..., - secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = ..., - mark_right: bool = ..., - include_bool: bool = ..., - backend: str = ..., + sharex: bool = False, + sharey: bool = False, + layout: tuple[int, int] | None = None, + figsize: tuple[float, float] | None = None, + use_index: bool = True, + title: Sequence[str] | None = None, + grid: bool | None = None, + legend: bool | Literal["reverse"] = False, + style: str | list[str] | dict[HashableT2, str] | None = None, + logx: bool | Literal["sym"] = False, + logy: bool | Literal["sym"] = False, + loglog: bool | Literal["sym"] = False, + xticks: Sequence[float] | None = None, + yticks: Sequence[float] | None = None, + xlim: tuple[float, float] | list[float] | None = None, + ylim: tuple[float, float] | list[float] | None = None, + xlabel: str | None = None, + ylabel: str | None = None, + rot: float | None = None, + fontsize: float | None = None, + colormap: str | Colormap | None = None, + colorbar: bool = False, + position: float = 0.5, + table: bool | Series | DataFrame = False, + yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + stacked: bool = False, + secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = False, + mark_right: bool = True, + include_bool: bool = False, + backend: str | None = None, **kwargs: Any, ) -> np_ndarray_object: ... @overload @@ -328,60 +328,60 @@ class PlotAccessor: self, *, data: Series | DataFrame | None = ..., - x: Hashable = ..., - y: Hashable | Sequence[Hashable] = ..., + x: Hashable = None, + y: Hashable | Sequence[Hashable] = None, kind: Literal["box"], - ax: Axes | None = ..., + ax: Axes | None = None, subplots: Literal[True] | Sequence[Iterable[HashableT1]], - sharex: bool = ..., - sharey: bool = ..., - layout: tuple[int, int] = ..., - figsize: tuple[float, float] = ..., - use_index: bool = ..., - title: Sequence[str] | None = ..., - grid: bool | None = ..., - legend: bool | Literal["reverse"] = ..., - style: str | list[str] | dict[HashableT2, str] = ..., - logx: bool | Literal["sym"] = ..., - logy: bool | Literal["sym"] = ..., - loglog: bool | Literal["sym"] = ..., - xticks: Sequence[float] = ..., - yticks: Sequence[float] = ..., - xlim: tuple[float, float] | list[float] = ..., - ylim: tuple[float, float] | list[float] = ..., - xlabel: str = ..., - ylabel: str = ..., - rot: float = ..., - fontsize: float = ..., - colormap: str | Colormap | None = ..., - colorbar: bool = ..., - position: float = ..., - table: bool | Series | DataFrame = ..., - yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str = ..., - stacked: bool = ..., - secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = ..., - mark_right: bool = ..., - include_bool: bool = ..., - backend: str = ..., + sharex: bool = False, + sharey: bool = False, + layout: tuple[int, int] | None = None, + figsize: tuple[float, float] | None = None, + use_index: bool = True, + title: Sequence[str] | None = None, + grid: bool | None = None, + legend: bool | Literal["reverse"] = False, + style: str | list[str] | dict[HashableT2, str] | None = None, + logx: bool | Literal["sym"] = False, + logy: bool | Literal["sym"] = False, + loglog: bool | Literal["sym"] = False, + xticks: Sequence[float] | None = None, + yticks: Sequence[float] | None = None, + xlim: tuple[float, float] | list[float] | None = None, + ylim: tuple[float, float] | list[float] | None = None, + xlabel: str | None = None, + ylabel: str | None = None, + rot: float | None = None, + fontsize: float | None = None, + colormap: str | Colormap | None = None, + colorbar: bool = False, + position: float = 0.5, + table: bool | Series | DataFrame = False, + yerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + xerr: DataFrame | Series | ArrayLike | dict[Any, Any] | str | None = None, + stacked: bool = False, + secondary_y: bool | list[HashableT3] | tuple[HashableT3, ...] = False, + mark_right: bool = True, + include_bool: bool = False, + backend: str | None = None, **kwargs: Any, ) -> pd.Series: ... @overload def line( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload def line( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, *, subplots: Literal[True], **kwargs: Any, @@ -389,19 +389,19 @@ class PlotAccessor: @overload def bar( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload def bar( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, *, subplots: Literal[True], **kwargs: Any, @@ -409,18 +409,18 @@ class PlotAccessor: @overload def barh( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., - subplots: Literal[False] | None = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload def barh( self, - x: Hashable = ..., - y: Hashable = ..., - color: _PlotAccessorColor = ..., + x: Hashable = None, + y: Hashable = None, + color: _PlotAccessorColor | None = None, *, subplots: Literal[True], **kwargs: Any, @@ -428,15 +428,15 @@ class PlotAccessor: @overload def box( self, - by: Hashable | list[HashableT] = ..., + by: Hashable | list[HashableT] = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload def box( self, - by: Hashable | list[HashableT] = ..., + by: Hashable | list[HashableT] = None, *, subplots: Literal[True], **kwargs: Any, @@ -444,17 +444,17 @@ class PlotAccessor: @overload def hist( self, - by: Hashable | list[HashableT] | None = ..., - bins: int = ..., + by: Hashable | list[HashableT] | None = None, + bins: int = 10, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload def hist( self, - by: Hashable | list[HashableT] | None = ..., - bins: int = ..., + by: Hashable | list[HashableT] | None = None, + bins: int = 10, *, subplots: Literal[True], **kwargs: Any, @@ -467,11 +467,11 @@ class PlotAccessor: | float | Callable[[gaussian_kde], float] | None - ) = ..., + ) = None, weights: np_ndarray_float | Series[float] | None = None, - ind: np_ndarray_float | int | None = ..., + ind: np_ndarray_float | int | None = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload @@ -482,9 +482,9 @@ class PlotAccessor: | float | Callable[[gaussian_kde], float] | None - ) = ..., + ) = None, weights: np_ndarray_float | Series[float] | None = None, - ind: np_ndarray_float | int | None = ..., + ind: np_ndarray_float | int | None = None, *, subplots: Literal[True], **kwargs: Any, @@ -492,26 +492,26 @@ class PlotAccessor: @overload def area( self, - x: Hashable | None = ..., - y: Hashable | None = ..., - stacked: bool = ..., + x: Hashable | None = None, + y: Hashable | None = None, + stacked: bool = True, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = False, **kwargs: Any, ) -> Axes: ... @overload def area( self, - x: Hashable | None = ..., - y: Hashable | None = ..., - stacked: bool = ..., + x: Hashable | None = None, + y: Hashable | None = None, + stacked: bool = True, *, subplots: Literal[True], **kwargs: Any, ) -> np_ndarray_object: ... @overload def pie( - self, y: Hashable, *, subplots: Literal[False] | None = ..., **kwargs: Any + self, y: Hashable, *, subplots: Literal[False] | None = None, **kwargs: Any ) -> Axes: ... @overload def pie( @@ -522,10 +522,10 @@ class PlotAccessor: self, x: Hashable, y: Hashable, - s: Hashable | Sequence[float] | None = ..., - c: Hashable | list[str] = ..., + s: Hashable | Sequence[float] | None = None, + c: Hashable | list[str] = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = None, **kwargs: Any, ) -> Axes: ... @overload @@ -533,8 +533,8 @@ class PlotAccessor: self, x: Hashable, y: Hashable, - s: Hashable | Sequence[float] | None = ..., - c: Hashable | list[str] = ..., + s: Hashable | Sequence[float] | None = None, + c: Hashable | list[str] = None, *, subplots: Literal[True], **kwargs: Any, @@ -544,11 +544,11 @@ class PlotAccessor: self, x: Hashable, y: Hashable, - C: Hashable | None = ..., - reduce_C_function: Callable[[list[Any]], float] | None = ..., - gridsize: int | tuple[int, int] | None = ..., + C: Hashable | None = None, + reduce_C_function: Callable[[list[Any]], float] | None = None, + gridsize: int | tuple[int, int] | None = None, *, - subplots: Literal[False] | None = ..., + subplots: Literal[False] | None = False, **kwargs: Any, ) -> Axes: ... @overload @@ -556,9 +556,9 @@ class PlotAccessor: self, x: Hashable, y: Hashable, - C: Hashable | None = ..., - reduce_C_function: Callable[[list[Any]], float] | None = ..., - gridsize: int | tuple[int, int] | None = ..., + C: Hashable | None = None, + reduce_C_function: Callable[[list[Any]], float] | None = None, + gridsize: int | tuple[int, int] | None = None, *, subplots: Literal[True], **kwargs: Any, diff --git a/tests/arrays/test_timedeltas.py b/tests/arrays/test_timedeltas.py index 5f0e0e6d8..39c8f1471 100644 --- a/tests/arrays/test_timedeltas.py +++ b/tests/arrays/test_timedeltas.py @@ -409,3 +409,42 @@ def test_timedelta_array_array() -> None: result = arr.__array__() check(assert_type(result, np_1darray_td), np_1darray, np.timedelta64) + + +def test_timedelta_array_sum() -> None: + idx = pd.TimedeltaIndex(["1 days", "2 days", "3 days"]) + arr = pd.array(idx) + + result = arr.sum() + check(assert_type(result, Timedelta), Timedelta) + + result = arr.sum(skipna=True) + check(assert_type(result, Timedelta), Timedelta) + + result = arr.sum(min_count=1) + check(assert_type(result, Timedelta), Timedelta) + + +def test_timedelta_array_std() -> None: + idx = pd.TimedeltaIndex(["1 days", "2 days", "3 days"]) + arr = pd.array(idx) + + result = arr.std() + check(assert_type(result, Timedelta), Timedelta) + + result = arr.std(skipna=True) + check(assert_type(result, Timedelta), Timedelta) + + result = arr.std(ddof=2) + check(assert_type(result, Timedelta), Timedelta) + + +def test_timedelta_array_median() -> None: + idx = pd.TimedeltaIndex(["1 days", "2 days", "3 days"]) + arr = pd.array(idx) + + result = arr.median() + check(assert_type(result, Timedelta), Timedelta) + + result = arr.median(skipna=True) + check(assert_type(result, Timedelta), Timedelta)