Skip to content

Improve results of stubtest #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = ...,
Expand All @@ -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 = ...,
Expand All @@ -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
Expand Down
20 changes: 6 additions & 14 deletions pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ...,
Expand All @@ -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 = ...,
Expand Down Expand Up @@ -941,6 +943,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
self,
level: IndexLabel = ...,
fill_value: int | _str | dict | None = ...,
sort: _bool = ...,
) -> DataFrame: ...
@overload
def map(
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -2087,15 +2088,13 @@ class Series(IndexOpsMixin[S1], NDFrame):
self,
axis: AxisIndex | None = ...,
skipna: _bool | None = ...,
level: None = ...,
numeric_only: _bool = ...,
**kwargs: Any,
) -> Scalar: ...
def std(
self,
axis: AxisIndex | None = ...,
skipna: _bool | None = ...,
level: None = ...,
ddof: int = ...,
numeric_only: _bool = ...,
**kwargs: Any,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -2263,7 +2256,6 @@ class TimestampSeries(Series[Timestamp]):
self,
axis: AxisIndex | None = ...,
skipna: _bool | None = ...,
level: None = ...,
ddof: int = ...,
numeric_only: _bool = ...,
**kwargs: Any,
Expand Down
23 changes: 0 additions & 23 deletions pandas-stubs/io/common.pyi

This file was deleted.

4 changes: 4 additions & 0 deletions pandas-stubs/io/parquet.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ from typing import Any
from pandas import DataFrame

from pandas._typing import (
DtypeBackend,
FilePath,
ParquetEngine,
ReadBuffer,
Expand All @@ -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: ...
4 changes: 4 additions & 0 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Loading