diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index ed3892817..006a9dbd4 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -2371,8 +2371,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): default_handler: Callable[[Any], JSONSerializable] | None = ..., lines: Literal[True], compression: CompressionOptions = ..., - index: _bool = ..., + index: _bool | None = ..., indent: int | None = ..., + storage_options: dict | None = ..., mode: Literal["a"], ) -> None: ... @overload @@ -2388,14 +2389,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): default_handler: Callable[[Any], JSONSerializable] | None = ..., lines: Literal[True], compression: CompressionOptions = ..., - index: _bool = ..., + index: _bool | None = ..., indent: int | None = ..., + storage_options: dict | None = ..., mode: Literal["a"], ) -> _str: ... @overload def to_json( self, path_or_buf: None = ..., + *, orient: JsonFrameOrient | None = ..., date_format: Literal["epoch", "iso"] | None = ..., double_precision: int = ..., @@ -2404,14 +2407,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): default_handler: Callable[[Any], JSONSerializable] | None = ..., lines: _bool = ..., compression: CompressionOptions = ..., - index: _bool = ..., + index: _bool | None = ..., indent: int | None = ..., + storage_options: dict | None = ..., mode: Literal["w"] = ..., ) -> _str: ... @overload def to_json( self, path_or_buf: FilePath | WriteBuffer[str] | WriteBuffer[bytes], + *, orient: JsonFrameOrient | None = ..., date_format: Literal["epoch", "iso"] | None = ..., double_precision: int = ..., @@ -2420,8 +2425,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack): default_handler: Callable[[Any], JSONSerializable] | None = ..., lines: _bool = ..., compression: CompressionOptions = ..., - index: _bool = ..., + index: _bool | None = ..., indent: int | None = ..., + storage_options: dict | None = ..., mode: Literal["w"] = ..., ) -> None: ... @overload diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 0fac9a3de..edde3f5d4 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -586,6 +586,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def to_json( self, path_or_buf: FilePath | WriteBuffer[_str] | WriteBuffer[bytes], + *, orient: JsonSeriesOrient | None = ..., date_format: Literal["epoch", "iso"] | None = ..., double_precision: int = ..., @@ -602,6 +603,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def to_json( self, path_or_buf: None = ..., + *, orient: JsonSeriesOrient | None = ..., date_format: Literal["epoch", "iso"] | None = ..., double_precision: int = ..., @@ -941,6 +943,7 @@ class Series(IndexOpsMixin[S1], NDFrame): self, level: IndexLabel = ..., fill_value: int | _str | dict | None = ..., + sort: _bool = ..., ) -> DataFrame: ... @overload def map( @@ -1207,6 +1210,7 @@ class Series(IndexOpsMixin[S1], NDFrame): figsize: tuple[float, float] | None = ..., bins: int | Sequence = ..., backend: _str | None = ..., + legend: _bool = ..., **kwargs: Any, ) -> SubplotBase: ... @final @@ -1217,7 +1221,7 @@ class Series(IndexOpsMixin[S1], NDFrame): def droplevel(self, level: Level | list[Level], axis: AxisIndex = ...) -> Self: ... def pop(self, item: Hashable) -> S1: ... @final - def squeeze(self) -> Series[S1] | Scalar: ... + def squeeze(self, axis: None = ...) -> Series[S1] | Scalar: ... @final def __abs__(self) -> Series[S1]: ... @final @@ -1329,7 +1333,7 @@ class Series(IndexOpsMixin[S1], NDFrame): @final def copy(self, deep: _bool = ...) -> Series[S1]: ... @final - def infer_objects(self) -> Series[S1]: ... + def infer_objects(self, copy: _bool = ...) -> Series[S1]: ... @overload def ffill( self, @@ -1969,7 +1973,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., min_count: int = ..., **kwargs: Any, @@ -1978,7 +1981,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., min_count: int = ..., **kwargs: Any, @@ -2078,7 +2080,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., ddof: int = ..., numeric_only: _bool = ..., **kwargs: Any, @@ -2087,7 +2088,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., **kwargs: Any, ) -> Scalar: ... @@ -2095,7 +2095,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., ddof: int = ..., numeric_only: _bool = ..., **kwargs: Any, @@ -2114,25 +2113,21 @@ class Series(IndexOpsMixin[S1], NDFrame): fill_value: float | None = ..., axis: AxisIndex | None = ..., ) -> Series[S1]: ... - # ignore needed because of mypy, for using `Never` as type-var. @overload def sum( self: Series[Never], axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., min_count: int = ..., **kwargs: Any, ) -> Any: ... - # ignore needed because of mypy, for overlapping overloads # between `Series[bool]` and `Series[int]`. @overload def sum( self: Series[bool], axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., min_count: int = ..., **kwargs: Any, @@ -2142,7 +2137,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self: Series[S1], axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., numeric_only: _bool = ..., min_count: int = ..., **kwargs: Any, @@ -2168,7 +2162,6 @@ class Series(IndexOpsMixin[S1], NDFrame): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., ddof: int = ..., numeric_only: _bool = ..., **kwargs: Any, @@ -2263,7 +2256,6 @@ class TimestampSeries(Series[Timestamp]): self, axis: AxisIndex | None = ..., skipna: _bool | None = ..., - level: None = ..., ddof: int = ..., numeric_only: _bool = ..., **kwargs: Any, diff --git a/pandas-stubs/io/common.pyi b/pandas-stubs/io/common.pyi deleted file mode 100644 index 335912b39..000000000 --- a/pandas-stubs/io/common.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from types import TracebackType -from typing import ( - IO, - AnyStr, - Generic, -) - -from pandas._typing import CompressionDict - -class IOHandles(Generic[AnyStr]): - handle: IO[AnyStr] - compression: CompressionDict - created_handles: list[IO[AnyStr]] = ... - is_wrapped: bool = ... - def close(self) -> None: ... - def __enter__(self) -> IOHandles[AnyStr]: ... - def __exit__( - self, - exc_type: type[BaseException] | None, - exc_value: BaseException | None, - traceback: TracebackType | None, - ) -> None: ... - def __init__(self, handle, compression, created_handles, is_wrapped) -> None: ... diff --git a/pandas-stubs/io/parquet.pyi b/pandas-stubs/io/parquet.pyi index 5a59bf159..fef8ee3a6 100644 --- a/pandas-stubs/io/parquet.pyi +++ b/pandas-stubs/io/parquet.pyi @@ -3,6 +3,7 @@ from typing import Any from pandas import DataFrame from pandas._typing import ( + DtypeBackend, FilePath, ParquetEngine, ReadBuffer, @@ -14,5 +15,8 @@ def read_parquet( engine: ParquetEngine = ..., columns: list[str] | None = ..., storage_options: StorageOptions = ..., + dtype_backend: DtypeBackend = ..., + filesystem: Any = None, + filters: list[tuple] | list[list[tuple]] | None = None, **kwargs: Any, ) -> DataFrame: ... diff --git a/tests/test_io.py b/tests/test_io.py index 6bfdd5734..0d0d27dbd 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -546,6 +546,10 @@ def test_parquet_options(): type(None), ) check(assert_type(read_parquet(path), DataFrame), DataFrame) + check(assert_type(read_parquet(path), DataFrame), DataFrame) + + sel = [("a", ">", 2)] + check(assert_type(read_parquet(path, filters=sel), DataFrame), DataFrame) def test_feather():