diff --git a/pandas-stubs/__init__.pyi b/pandas-stubs/__init__.pyi index f164b0589..aa3984914 100644 --- a/pandas-stubs/__init__.pyi +++ b/pandas-stubs/__init__.pyi @@ -105,7 +105,6 @@ from pandas.io.api import ( read_excel as read_excel, read_feather as read_feather, read_fwf as read_fwf, - read_gbq as read_gbq, read_hdf as read_hdf, read_html as read_html, read_json as read_json, diff --git a/pandas-stubs/_libs/tslibs/offsets.pyi b/pandas-stubs/_libs/tslibs/offsets.pyi index 6ac91ce88..467b32204 100644 --- a/pandas-stubs/_libs/tslibs/offsets.pyi +++ b/pandas-stubs/_libs/tslibs/offsets.pyi @@ -15,10 +15,8 @@ from typing import ( from dateutil.relativedelta import weekday as WeekdayClass import numpy as np from pandas import Timestamp -from pandas.core.indexes.datetimes import DatetimeIndex from typing_extensions import Self -from pandas._libs.tslibs.timedeltas import Timedelta from pandas._typing import npt from pandas.tseries.holiday import AbstractHolidayCalendar @@ -88,7 +86,6 @@ class BaseOffset: def rule_code(self) -> str: ... @property def freqstr(self) -> str: ... - def apply_index(self, dtindex: DatetimeIndex) -> DatetimeIndex: ... def rollback(self, dt: datetime) -> datetime: ... def rollforward(self, dt: datetime) -> datetime: ... def is_on_offset(self, dt: datetime) -> bool: ... @@ -96,9 +93,6 @@ class BaseOffset: def __getstate__(self): ... @property def nanos(self) -> int: ... - def onOffset(self, dt: datetime) -> bool: ... - def isAnchored(self) -> bool: ... - def is_anchored(self) -> bool: ... class SingleConstructorOffset(BaseOffset): def __reduce__(self): ... @@ -106,8 +100,6 @@ class SingleConstructorOffset(BaseOffset): class Tick(SingleConstructorOffset): def __init__(self, n: int = ..., normalize: bool = ...) -> None: ... @property - def delta(self) -> Timedelta: ... - @property def nanos(self) -> int: ... def delta_to_tick(delta: timedelta) -> Tick: ... diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 1f8a26489..a647d1f32 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -679,7 +679,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): def info( self, verbose: bool | None = ..., - buf: WriteBuffer[str] = ..., + buf: WriteBuffer[str] | None = ..., max_cols: int | None = ..., memory_usage: bool | Literal["deep"] | None = ..., show_counts: bool | None = ..., diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 859438415..5d4fb1bb0 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1131,7 +1131,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def info( self, verbose: bool | None = ..., - buf: WriteBuffer[str] = ..., + buf: WriteBuffer[str] | None = ..., memory_usage: bool | Literal["deep"] | None = ..., show_counts: bool | None = ..., ) -> None: ... diff --git a/pandas-stubs/io/excel/_base.pyi b/pandas-stubs/io/excel/_base.pyi index 5b9d5a9c4..db5ca5f0b 100644 --- a/pandas-stubs/io/excel/_base.pyi +++ b/pandas-stubs/io/excel/_base.pyi @@ -58,7 +58,7 @@ def read_excel( false_values: Iterable[Hashable] | None = ..., skiprows: int | Sequence[int] | Callable[[object], bool] | None = ..., nrows: int | None = ..., - na_values: Sequence[str] | dict[str | int, Sequence[str]] = ..., + na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ..., keep_default_na: bool = ..., na_filter: bool = ..., verbose: bool = ..., @@ -75,6 +75,7 @@ def read_excel( skipfooter: int = ..., storage_options: StorageOptions = ..., dtype_backend: DtypeBackend | NoDefault = ..., + engine_kwargs: dict[str, Any] | None = ..., ) -> dict[IntStrT, DataFrame]: ... @overload def read_excel( @@ -100,7 +101,7 @@ def read_excel( false_values: Iterable[Hashable] | None = ..., skiprows: int | Sequence[int] | Callable[[object], bool] | None = ..., nrows: int | None = ..., - na_values: Sequence[str] | dict[str | int, Sequence[str]] = ..., + na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ..., keep_default_na: bool = ..., na_filter: bool = ..., verbose: bool = ..., @@ -117,6 +118,7 @@ def read_excel( skipfooter: int = ..., storage_options: StorageOptions = ..., dtype_backend: DtypeBackend | NoDefault = ..., + engine_kwargs: dict[str, Any] | None = ..., ) -> dict[str, DataFrame]: ... @overload # mypy says this won't be matched @@ -143,7 +145,7 @@ def read_excel( # type: ignore[overload-cannot-match] false_values: Iterable[Hashable] | None = ..., skiprows: int | Sequence[int] | Callable[[object], bool] | None = ..., nrows: int | None = ..., - na_values: Sequence[str] | dict[str | int, Sequence[str]] = ..., + na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ..., keep_default_na: bool = ..., na_filter: bool = ..., verbose: bool = ..., @@ -160,6 +162,7 @@ def read_excel( # type: ignore[overload-cannot-match] skipfooter: int = ..., storage_options: StorageOptions = ..., dtype_backend: DtypeBackend | NoDefault = ..., + engine_kwargs: dict[str, Any] | None = ..., ) -> dict[int | str, DataFrame]: ... @overload def read_excel( @@ -185,7 +188,7 @@ def read_excel( false_values: Iterable[Hashable] | None = ..., skiprows: int | Sequence[int] | Callable[[object], bool] | None = ..., nrows: int | None = ..., - na_values: Sequence[str] | dict[str | int, Sequence[str]] = ..., + na_values: Sequence[str] | dict[str | int, Sequence[str]] | None = ..., keep_default_na: bool = ..., na_filter: bool = ..., verbose: bool = ..., @@ -202,6 +205,7 @@ def read_excel( skipfooter: int = ..., storage_options: StorageOptions = ..., dtype_backend: DtypeBackend | NoDefault = ..., + engine_kwargs: dict[str, Any] | None = ..., ) -> DataFrame: ... class ExcelWriter: diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index 295363421..74bb84ffe 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -11,7 +11,6 @@ from typing import ( from matplotlib.colors import Colormap import numpy as np -from pandas import Index from pandas.core.frame import DataFrame from pandas.core.series import Series @@ -26,6 +25,7 @@ from pandas._typing import ( Level, QuantileInterpolation, Scalar, + StorageOptions, T, WriteBuffer, WriteExcelBuffer, @@ -53,10 +53,6 @@ class _DataFrameFunc(Protocol): ) -> npt.NDArray | DataFrame: ... class Styler(StylerRenderer): - @property - def columns(self) -> Index[Any]: ... - @property - def index(self) -> Index[Any]: ... def __init__( self, data: DataFrame | Series, @@ -79,6 +75,7 @@ class Styler(StylerRenderer): ttips: DataFrame, props: CSSProperties | None = ..., css_class: str | None = ..., + as_title_attribute: bool = ..., ) -> Styler: ... def to_excel( self, @@ -98,8 +95,7 @@ class Styler(StylerRenderer): inf_rep: str = ..., verbose: bool = ..., freeze_panes: tuple[int, int] | None = ..., - # TODO: Listed in docs but not in function decl - # storage_options: StorageOptions = ..., + storage_options: StorageOptions | None = ..., ) -> None: ... @overload def to_latex( @@ -314,7 +310,7 @@ class Styler(StylerRenderer): axis: Axis | None = ..., *, color: str | list[str] | tuple[str, str] | None = ..., - cmap: str | Colormap = ..., + cmap: str | Colormap | None = ..., width: float = ..., height: float = ..., align: ( diff --git a/pandas-stubs/io/formats/style_render.pyi b/pandas-stubs/io/formats/style_render.pyi index 762eea0da..a46ee60b1 100644 --- a/pandas-stubs/io/formats/style_render.pyi +++ b/pandas-stubs/io/formats/style_render.pyi @@ -81,3 +81,7 @@ class StylerRenderer: axis: Axis = ..., level: Level | list[Level] | None = ..., ) -> Self: ... + @property + def columns(self) -> Index[Any]: ... + @property + def index(self) -> Index[Any]: ... diff --git a/pandas-stubs/io/gbq.pyi b/pandas-stubs/io/gbq.pyi deleted file mode 100644 index b4420a6c2..000000000 --- a/pandas-stubs/io/gbq.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import ( - Any, - Literal, -) - -from pandas.core.frame import DataFrame - -def read_gbq( - query: str, - project_id: str | None = ..., - index_col: str | None = ..., - col_order: list[str] | None = ..., - reauth: bool = ..., - auth_local_webserver: bool = ..., - dialect: Literal["legacy", "standard"] | None = ..., - location: str | None = ..., - configuration: dict[str, Any] | None = ..., - # Google type, not available - credentials: Any = ..., - use_bqstorage_api: bool | None = ..., - max_results: int | None = ..., - progress_bar_type: Literal["tqdm", "tqdm_notebook", "tqdm_gui"] | None = ..., -) -> DataFrame: ... diff --git a/pandas-stubs/io/orc.pyi b/pandas-stubs/io/orc.pyi index b8fdc9506..18e06fede 100644 --- a/pandas-stubs/io/orc.pyi +++ b/pandas-stubs/io/orc.pyi @@ -14,5 +14,8 @@ def read_orc( path: FilePath | ReadBuffer[bytes], columns: list[HashableT] | None = ..., dtype_backend: DtypeBackend | NoDefault = ..., + # TODO type with the correct pyarrow types + # filesystem: pyarrow.fs.FileSystem | fsspec.spec.AbstractFileSystem + filesystem: Any | None = ..., **kwargs: Any, ) -> DataFrame: ... diff --git a/pandas-stubs/io/sql.pyi b/pandas-stubs/io/sql.pyi index bf30b3f84..47c55e1aa 100644 --- a/pandas-stubs/io/sql.pyi +++ b/pandas-stubs/io/sql.pyi @@ -143,7 +143,6 @@ def read_sql( ) -> DataFrame: ... class PandasSQL: - def read_sql(self, *args, **kwargs): ... def to_sql( self, frame: DataFrame, @@ -159,6 +158,8 @@ class PandasSQL: | Callable[[SQLTable, Any, list[str], Iterable], int | None] | None ) = ..., + engine: str = ..., + **engine_kwargs: dict[str, Any] | None, ) -> int | None: ... class SQLTable: diff --git a/pandas-stubs/tseries/frequencies.pyi b/pandas-stubs/tseries/frequencies.pyi index d65f096f7..c2143cb96 100644 --- a/pandas-stubs/tseries/frequencies.pyi +++ b/pandas-stubs/tseries/frequencies.pyi @@ -12,8 +12,7 @@ from pandas.tseries.offsets import DateOffset def get_period_alias(offset_str: str) -> str | None: ... @overload -def to_offset(freq: None) -> None: ... +def to_offset(freq: None, is_period: bool = ...) -> None: ... @overload -def to_offset(freq: Frequency) -> DateOffset: ... -def get_offset(name: str) -> DateOffset: ... +def to_offset(freq: Frequency, is_period: bool = ...) -> DateOffset: ... def infer_freq(index: Series | DatetimeIndex | TimedeltaIndex) -> str | None: ... diff --git a/pandas-stubs/util/_tester.pyi b/pandas-stubs/util/_tester.pyi index 6c73287c0..a02a1c11c 100644 --- a/pandas-stubs/util/_tester.pyi +++ b/pandas-stubs/util/_tester.pyi @@ -1 +1 @@ -def test(extra_args=...) -> None: ... +def test(extra_args: list[str] | None = ..., run_doctests: bool = ...) -> None: ... diff --git a/pandas-stubs/util/_validators.pyi b/pandas-stubs/util/_validators.pyi deleted file mode 100644 index 11bc7e537..000000000 --- a/pandas-stubs/util/_validators.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from collections.abc import Iterable - -import numpy as np - -def validate_args(fname, args, max_fname_arg_count, compat_args) -> None: ... -def validate_kwargs(fname, kwargs, compat_args) -> None: ... -def validate_args_and_kwargs( - fname, args, kwargs, max_fname_arg_count, compat_args -) -> None: ... -def validate_bool_kwarg(value, arg_name): ... -def validate_axis_style_args(data, args, kwargs, arg_name, method_name): ... -def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = ...): ... -def validate_percentile(q: float | Iterable[float]) -> np.ndarray: ...