Skip to content

Commit 264cccb

Browse files
Improve results of stubtest
1 parent f340905 commit 264cccb

File tree

5 files changed

+27
-41
lines changed

5 files changed

+27
-41
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,8 +2371,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23712371
default_handler: Callable[[Any], JSONSerializable] | None = ...,
23722372
lines: Literal[True],
23732373
compression: CompressionOptions = ...,
2374-
index: _bool = ...,
2374+
index: _bool | None = ...,
23752375
indent: int | None = ...,
2376+
storage_options: dict | None = ...,
23762377
mode: Literal["a"],
23772378
) -> None: ...
23782379
@overload
@@ -2388,14 +2389,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23882389
default_handler: Callable[[Any], JSONSerializable] | None = ...,
23892390
lines: Literal[True],
23902391
compression: CompressionOptions = ...,
2391-
index: _bool = ...,
2392+
index: _bool | None = ...,
23922393
indent: int | None = ...,
2394+
storage_options: dict | None = ...,
23932395
mode: Literal["a"],
23942396
) -> _str: ...
23952397
@overload
23962398
def to_json(
23972399
self,
23982400
path_or_buf: None = ...,
2401+
*,
23992402
orient: JsonFrameOrient | None = ...,
24002403
date_format: Literal["epoch", "iso"] | None = ...,
24012404
double_precision: int = ...,
@@ -2404,14 +2407,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
24042407
default_handler: Callable[[Any], JSONSerializable] | None = ...,
24052408
lines: _bool = ...,
24062409
compression: CompressionOptions = ...,
2407-
index: _bool = ...,
2410+
index: _bool | None = ...,
24082411
indent: int | None = ...,
2412+
storage_options: dict | None = ...,
24092413
mode: Literal["w"] = ...,
24102414
) -> _str: ...
24112415
@overload
24122416
def to_json(
24132417
self,
24142418
path_or_buf: FilePath | WriteBuffer[str] | WriteBuffer[bytes],
2419+
*,
24152420
orient: JsonFrameOrient | None = ...,
24162421
date_format: Literal["epoch", "iso"] | None = ...,
24172422
double_precision: int = ...,
@@ -2420,8 +2425,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
24202425
default_handler: Callable[[Any], JSONSerializable] | None = ...,
24212426
lines: _bool = ...,
24222427
compression: CompressionOptions = ...,
2423-
index: _bool = ...,
2428+
index: _bool | None = ...,
24242429
indent: int | None = ...,
2430+
storage_options: dict | None = ...,
24252431
mode: Literal["w"] = ...,
24262432
) -> None: ...
24272433
@overload

pandas-stubs/core/series.pyi

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
586586
def to_json(
587587
self,
588588
path_or_buf: FilePath | WriteBuffer[_str] | WriteBuffer[bytes],
589+
*,
589590
orient: JsonSeriesOrient | None = ...,
590591
date_format: Literal["epoch", "iso"] | None = ...,
591592
double_precision: int = ...,
@@ -602,6 +603,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
602603
def to_json(
603604
self,
604605
path_or_buf: None = ...,
606+
*,
605607
orient: JsonSeriesOrient | None = ...,
606608
date_format: Literal["epoch", "iso"] | None = ...,
607609
double_precision: int = ...,
@@ -941,6 +943,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
941943
self,
942944
level: IndexLabel = ...,
943945
fill_value: int | _str | dict | None = ...,
946+
sort: _bool = ...,
944947
) -> DataFrame: ...
945948
@overload
946949
def map(
@@ -1132,6 +1135,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
11321135
freq: DateOffset | timedelta | _str | None = ...,
11331136
axis: Axis = ...,
11341137
fill_value: Scalar | NAType | None = ...,
1138+
suffix: _str | None = ..., # has no effect at the moment
11351139
) -> Series: ...
11361140
def info(
11371141
self,
@@ -1207,6 +1211,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
12071211
figsize: tuple[float, float] | None = ...,
12081212
bins: int | Sequence = ...,
12091213
backend: _str | None = ...,
1214+
legend: _bool = ...,
12101215
**kwargs: Any,
12111216
) -> SubplotBase: ...
12121217
@final
@@ -1217,7 +1222,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
12171222
def droplevel(self, level: Level | list[Level], axis: AxisIndex = ...) -> Self: ...
12181223
def pop(self, item: Hashable) -> S1: ...
12191224
@final
1220-
def squeeze(self) -> Series[S1] | Scalar: ...
1225+
def squeeze(self, axis: Axis = ...) -> Series[S1] | Scalar: ...
12211226
@final
12221227
def __abs__(self) -> Series[S1]: ...
12231228
@final
@@ -1329,7 +1334,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
13291334
@final
13301335
def copy(self, deep: _bool = ...) -> Series[S1]: ...
13311336
@final
1332-
def infer_objects(self) -> Series[S1]: ...
1337+
def infer_objects(self, copy: _bool = ...) -> Series[S1]: ...
13331338
@overload
13341339
def ffill(
13351340
self,
@@ -1579,6 +1584,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
15791584
periods: int = ...,
15801585
fill_method: None = ...,
15811586
freq: DateOffset | timedelta | _str | None = ...,
1587+
limit: int | None = ..., # deprecated since 2.1
15821588
*,
15831589
fill_value: Scalar | NAType | None = ...,
15841590
) -> Series[float]: ...
@@ -1969,7 +1975,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
19691975
self,
19701976
axis: AxisIndex | None = ...,
19711977
skipna: _bool | None = ...,
1972-
level: None = ...,
19731978
numeric_only: _bool = ...,
19741979
min_count: int = ...,
19751980
**kwargs: Any,
@@ -1978,7 +1983,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
19781983
self,
19791984
axis: AxisIndex | None = ...,
19801985
skipna: _bool | None = ...,
1981-
level: None = ...,
19821986
numeric_only: _bool = ...,
19831987
min_count: int = ...,
19841988
**kwargs: Any,
@@ -2078,7 +2082,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
20782082
self,
20792083
axis: AxisIndex | None = ...,
20802084
skipna: _bool | None = ...,
2081-
level: None = ...,
20822085
ddof: int = ...,
20832086
numeric_only: _bool = ...,
20842087
**kwargs: Any,
@@ -2087,15 +2090,13 @@ class Series(IndexOpsMixin[S1], NDFrame):
20872090
self,
20882091
axis: AxisIndex | None = ...,
20892092
skipna: _bool | None = ...,
2090-
level: None = ...,
20912093
numeric_only: _bool = ...,
20922094
**kwargs: Any,
20932095
) -> Scalar: ...
20942096
def std(
20952097
self,
20962098
axis: AxisIndex | None = ...,
20972099
skipna: _bool | None = ...,
2098-
level: None = ...,
20992100
ddof: int = ...,
21002101
numeric_only: _bool = ...,
21012102
**kwargs: Any,
@@ -2114,25 +2115,21 @@ class Series(IndexOpsMixin[S1], NDFrame):
21142115
fill_value: float | None = ...,
21152116
axis: AxisIndex | None = ...,
21162117
) -> Series[S1]: ...
2117-
# ignore needed because of mypy, for using `Never` as type-var.
21182118
@overload
21192119
def sum(
21202120
self: Series[Never],
21212121
axis: AxisIndex | None = ...,
21222122
skipna: _bool | None = ...,
2123-
level: None = ...,
21242123
numeric_only: _bool = ...,
21252124
min_count: int = ...,
21262125
**kwargs: Any,
21272126
) -> Any: ...
2128-
# ignore needed because of mypy, for overlapping overloads
21292127
# between `Series[bool]` and `Series[int]`.
21302128
@overload
21312129
def sum(
21322130
self: Series[bool],
21332131
axis: AxisIndex | None = ...,
21342132
skipna: _bool | None = ...,
2135-
level: None = ...,
21362133
numeric_only: _bool = ...,
21372134
min_count: int = ...,
21382135
**kwargs: Any,
@@ -2142,7 +2139,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
21422139
self: Series[S1],
21432140
axis: AxisIndex | None = ...,
21442141
skipna: _bool | None = ...,
2145-
level: None = ...,
21462142
numeric_only: _bool = ...,
21472143
min_count: int = ...,
21482144
**kwargs: Any,
@@ -2168,7 +2164,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
21682164
self,
21692165
axis: AxisIndex | None = ...,
21702166
skipna: _bool | None = ...,
2171-
level: None = ...,
21722167
ddof: int = ...,
21732168
numeric_only: _bool = ...,
21742169
**kwargs: Any,
@@ -2263,7 +2258,6 @@ class TimestampSeries(Series[Timestamp]):
22632258
self,
22642259
axis: AxisIndex | None = ...,
22652260
skipna: _bool | None = ...,
2266-
level: None = ...,
22672261
ddof: int = ...,
22682262
numeric_only: _bool = ...,
22692263
**kwargs: Any,

pandas-stubs/io/common.pyi

Lines changed: 0 additions & 23 deletions
This file was deleted.

pandas-stubs/io/parquet.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Any
33
from pandas import DataFrame
44

55
from pandas._typing import (
6+
DtypeBackend,
67
FilePath,
78
ParquetEngine,
89
ReadBuffer,
@@ -14,5 +15,9 @@ def read_parquet(
1415
engine: ParquetEngine = ...,
1516
columns: list[str] | None = ...,
1617
storage_options: StorageOptions = ...,
18+
use_nullable_dtypes: bool = ..., # deprecated since 2.0
19+
dtype_backend: DtypeBackend = ...,
20+
filesystem: Any = None,
21+
filters: list[tuple] | list[list[tuple]] | None = None,
1722
**kwargs: Any,
1823
) -> DataFrame: ...

tests/test_io.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ def test_parquet_options():
546546
type(None),
547547
)
548548
check(assert_type(read_parquet(path), DataFrame), DataFrame)
549+
check(assert_type(read_parquet(path), DataFrame), DataFrame)
550+
551+
sel = [("a", ">", 2)]
552+
check(assert_type(read_parquet(path, filters=sel), DataFrame), DataFrame)
549553

550554

551555
def test_feather():

0 commit comments

Comments
 (0)