Skip to content

Commit 99a0686

Browse files
committed
merge
2 parents 61896fd + ae72ced commit 99a0686

File tree

15 files changed

+106
-102
lines changed

15 files changed

+106
-102
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,21 @@ else:
308308
@overload
309309
def __getitem__(self, key: Hashable) -> Series: ...
310310

311+
_AstypeArgExt: TypeAlias = (
312+
AstypeArg
313+
| Literal[
314+
"number",
315+
"datetime64",
316+
"datetime",
317+
"integer",
318+
"timedelta",
319+
"timedelta64",
320+
"datetimetz",
321+
"datetime64[ns]",
322+
]
323+
)
324+
_AstypeArgExtList: TypeAlias = _AstypeArgExt | list[_AstypeArgExt]
325+
311326
class DataFrame(NDFrame, OpsMixin, _GetItemHack):
312327

313328
__hash__: ClassVar[None] # type: ignore[assignment] # pyright: ignore[reportIncompatibleMethodOverride]
@@ -455,6 +470,21 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
455470
into: type[dict] = ...,
456471
index: bool = ...,
457472
) -> dict[Hashable, Any]: ...
473+
def to_gbq(
474+
self,
475+
destination_table: str,
476+
*,
477+
project_id: str | None = ...,
478+
chunksize: int | None = ...,
479+
reauth: bool = ...,
480+
if_exists: Literal["fail", "replace", "append"] = ...,
481+
auth_local_webserver: bool = ...,
482+
table_schema: list[dict[str, str]] | None = ...,
483+
location: str | None = ...,
484+
progress_bar: bool = ...,
485+
# Google type, not available
486+
credentials: Any = ...,
487+
) -> None: ...
458488
@classmethod
459489
def from_records(
460490
cls,
@@ -516,6 +546,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
516546
def to_parquet(
517547
self,
518548
path: FilePath | WriteBuffer[bytes],
549+
*,
519550
engine: ParquetEngine = ...,
520551
compression: Literal["snappy", "gzip", "brotli", "lz4", "zstd"] | None = ...,
521552
index: bool | None = ...,
@@ -527,6 +558,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
527558
def to_parquet(
528559
self,
529560
path: None = ...,
561+
*,
530562
engine: ParquetEngine = ...,
531563
compression: Literal["snappy", "gzip", "brotli", "lz4", "zstd"] | None = ...,
532564
index: bool | None = ...,
@@ -556,6 +588,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
556588
def to_html(
557589
self,
558590
buf: FilePath | WriteBuffer[str],
591+
*,
559592
columns: SequenceNotStr[Hashable] | Index | Series | None = ...,
560593
col_space: ColspaceArgType | None = ...,
561594
header: _bool = ...,
@@ -603,6 +636,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
603636
def to_html(
604637
self,
605638
buf: None = ...,
639+
*,
606640
columns: Sequence[Hashable] | None = ...,
607641
col_space: ColspaceArgType | None = ...,
608642
header: _bool = ...,
@@ -738,27 +772,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
738772
def eval(
739773
self, expr: _str, *, inplace: Literal[False] = ..., **kwargs: Any
740774
) -> Scalar | np.ndarray | Self | Series: ...
741-
AstypeArgExt: TypeAlias = (
742-
AstypeArg
743-
| Literal[
744-
"number",
745-
"datetime64",
746-
"datetime",
747-
"integer",
748-
"timedelta",
749-
"timedelta64",
750-
"datetimetz",
751-
"datetime64[ns]",
752-
]
753-
)
754-
AstypeArgExtList: TypeAlias = AstypeArgExt | list[AstypeArgExt]
755775
@overload
756776
def select_dtypes(
757-
self, include: StrDtypeArg, exclude: AstypeArgExtList | None = ...
777+
self, include: StrDtypeArg, exclude: _AstypeArgExtList | None = ...
758778
) -> Never: ...
759779
@overload
760780
def select_dtypes(
761-
self, include: AstypeArgExtList | None, exclude: StrDtypeArg
781+
self, include: _AstypeArgExtList | None, exclude: StrDtypeArg
762782
) -> Never: ...
763783
@overload
764784
def select_dtypes(self, exclude: StrDtypeArg) -> Never: ...
@@ -767,19 +787,19 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
767787
@overload
768788
def select_dtypes(
769789
self,
770-
include: AstypeArgExtList,
771-
exclude: AstypeArgExtList | None = ...,
790+
include: _AstypeArgExtList,
791+
exclude: _AstypeArgExtList | None = ...,
772792
) -> Self: ...
773793
@overload
774794
def select_dtypes(
775795
self,
776-
include: AstypeArgExtList | None,
777-
exclude: AstypeArgExtList,
796+
include: _AstypeArgExtList | None,
797+
exclude: _AstypeArgExtList,
778798
) -> Self: ...
779799
@overload
780800
def select_dtypes(
781801
self,
782-
exclude: AstypeArgExtList,
802+
exclude: _AstypeArgExtList,
783803
) -> Self: ...
784804
def insert(
785805
self,
@@ -802,6 +822,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
802822
def reindex(
803823
self,
804824
labels: Axes | None = ...,
825+
*,
805826
index: Axes | None = ...,
806827
columns: Axes | None = ...,
807828
axis: Axis | None = ...,
@@ -1293,8 +1314,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
12931314
def pivot(
12941315
self,
12951316
*,
1317+
columns: IndexLabel,
12961318
index: IndexLabel = ...,
1297-
columns: IndexLabel = ...,
12981319
values: IndexLabel = ...,
12991320
) -> Self: ...
13001321
def pivot_table(
@@ -1312,11 +1333,18 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
13121333
) -> Self: ...
13131334
@overload
13141335
def stack(
1315-
self, level: IndexLabel = ..., dropna: _bool = ..., sort: _bool = ...
1336+
self,
1337+
level: IndexLabel = ...,
1338+
*,
1339+
future_stack: Literal[True],
13161340
) -> Self | Series: ...
13171341
@overload
13181342
def stack(
1319-
self, level: IndexLabel = ..., future_stack: _bool = ...
1343+
self,
1344+
level: IndexLabel = ...,
1345+
dropna: _bool = ...,
1346+
sort: _bool = ...,
1347+
future_stack: Literal[False] = ...,
13201348
) -> Self | Series: ...
13211349
def explode(
13221350
self, column: Sequence[Hashable], ignore_index: _bool = False
@@ -1571,15 +1599,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
15711599
method: Literal["pearson", "kendall", "spearman"] = ...,
15721600
numeric_only: _bool = False,
15731601
) -> Series: ...
1574-
@overload
1575-
def count(
1576-
self, axis: Axis = ..., numeric_only: _bool = ..., *, level: Level
1577-
) -> Self: ...
1578-
@overload
1579-
def count(
1580-
self, axis: Axis = ..., level: None = ..., numeric_only: _bool = ...
1581-
) -> Series: ...
1582-
def nunique(self, axis: Axis = 0, dropna: bool = True) -> Series: ...
1602+
def count(self, axis: Axis = 0, numeric_only: _bool = ...) -> Series[int]: ...
1603+
def nunique(self, axis: Axis = 0, dropna: bool = ...) -> Series: ...
15831604
def idxmax(
15841605
self,
15851606
axis: Axis = 0,
@@ -1784,6 +1805,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
17841805
self,
17851806
start_time: _str | dt.time,
17861807
end_time: _str | dt.time,
1808+
inclusive: IntervalClosedType = ...,
17871809
axis: Axis | None = 0,
17881810
) -> Self: ...
17891811
@overload
@@ -1998,7 +2020,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
19982020
@final
19992021
def head(self, n: int = 5) -> Self: ...
20002022
@final
2001-
def infer_objects(self) -> Self: ...
2023+
def infer_objects(self, copy: _bool | None = ...) -> Self: ...
20022024
@overload
20032025
def interpolate(
20042026
self,
@@ -2094,15 +2116,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
20942116
self,
20952117
axis: Axis | None = ...,
20962118
skipna: _bool | None = True,
2097-
level: None = ...,
20982119
numeric_only: _bool = False,
20992120
**kwargs: Any,
21002121
) -> Series: ...
21012122
def min(
21022123
self,
21032124
axis: Axis | None = ...,
21042125
skipna: _bool | None = True,
2105-
level: None = ...,
21062126
numeric_only: _bool = False,
21072127
**kwargs: Any,
21082128
) -> Series: ...
@@ -2134,8 +2154,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21342154
periods: int = 1,
21352155
fill_method: None = None,
21362156
freq: DateOffset | dt.timedelta | _str | None = ...,
2137-
*,
2138-
axis: Axis = ...,
21392157
fill_value: Scalar | NAType | None = ...,
21402158
) -> Self: ...
21412159
def pop(self, item: _str) -> Series: ...
@@ -2150,7 +2168,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21502168
self,
21512169
axis: Axis | None = ...,
21522170
skipna: _bool | None = True,
2153-
level: None = ...,
21542171
numeric_only: _bool = False,
21552172
min_count: int = 0,
21562173
**kwargs: Any,
@@ -2159,7 +2176,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
21592176
self,
21602177
axis: Axis | None = ...,
21612178
skipna: _bool = True,
2162-
level: None = ...,
21632179
numeric_only: _bool = False,
21642180
min_count: int = 0,
21652181
**kwargs: Any,
@@ -2322,18 +2338,16 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23222338
self,
23232339
axis: Axis | None = ...,
23242340
skipna: _bool | None = True,
2325-
level: None = ...,
23262341
ddof: int = 1,
23272342
numeric_only: _bool = False,
23282343
**kwargs: Any,
23292344
) -> Series: ...
23302345
# Not actually positional, but used to handle removal of deprecated
2331-
def set_axis(self, labels, *, axis: Axis, copy: _bool = ...) -> Self: ...
2346+
def set_axis(self, labels, *, axis: Axis = ..., copy: _bool = ...) -> Self: ...
23322347
def skew(
23332348
self,
23342349
axis: Axis | None = ...,
23352350
skipna: _bool | None = True,
2336-
level: None = ...,
23372351
numeric_only: _bool = False,
23382352
**kwargs: Any,
23392353
) -> Series: ...
@@ -2343,7 +2357,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23432357
self,
23442358
axis: Axis = ...,
23452359
skipna: _bool = True,
2346-
level: None = ...,
23472360
ddof: int = 1,
23482361
numeric_only: _bool = False,
23492362
**kwargs: Any,
@@ -2364,9 +2377,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
23642377
) -> Self: ...
23652378
def sum(
23662379
self,
2367-
axis: Axis | None = ...,
2380+
axis: Axis = ...,
23682381
skipna: _bool | None = True,
2369-
level: None = ...,
23702382
numeric_only: _bool = False,
23712383
min_count: int = 0,
23722384
**kwargs: Any,
@@ -2451,6 +2463,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
24512463
def to_string(
24522464
self,
24532465
buf: FilePath | WriteBuffer[str],
2466+
*,
24542467
columns: SequenceNotStr[Hashable] | Index | Series | None = ...,
24552468
col_space: int | list[int] | dict[HashableT, int] | None = ...,
24562469
header: _bool | list[_str] | tuple[str, ...] = ...,
@@ -2474,6 +2487,7 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
24742487
def to_string(
24752488
self,
24762489
buf: None = ...,
2490+
*,
24772491
columns: Sequence[Hashable] | Index | Series | None = ...,
24782492
col_space: int | list[int] | dict[Hashable, int] | None = ...,
24792493
header: _bool | Sequence[_str] = ...,
@@ -2530,9 +2544,8 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
25302544
) -> Self: ...
25312545
def var(
25322546
self,
2533-
axis: Axis | None = ...,
2547+
axis: Axis = ...,
25342548
skipna: _bool | None = True,
2535-
level: None = ...,
25362549
ddof: int = 1,
25372550
numeric_only: _bool = False,
25382551
**kwargs: Any,

pandas-stubs/core/generic.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ class NDFrame(indexing.IndexingMixin):
142142
def to_markdown(
143143
self,
144144
buf: FilePath | WriteBuffer[str],
145-
mode: FileWriteMode | None = ...,
145+
*,
146+
mode: FileWriteMode = ...,
146147
index: _bool = ...,
147148
storage_options: StorageOptions = ...,
148149
**kwargs: Any,
@@ -151,6 +152,7 @@ class NDFrame(indexing.IndexingMixin):
151152
def to_markdown(
152153
self,
153154
buf: None = ...,
155+
*,
154156
mode: FileWriteMode | None = ...,
155157
index: _bool = ...,
156158
storage_options: StorageOptions = ...,

pandas-stubs/core/indexes/accessors.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ class _DatetimeOtherOps(Generic[_DTOtherOpsDateReturnType, _DTOtherOpsTimeReturn
140140
@property
141141
def timetz(self) -> _DTOtherOpsTimeReturnType: ...
142142

143-
class DatetimeAndPeriodProperties(_DatetimeFieldOps[Series[int]]): ...
144143
class _DatetimeLikeOps(
145144
_DatetimeFieldOps[_DTFieldOpsReturnType],
146145
_DatetimeObjectOps[_DTFreqReturnType],

pandas-stubs/core/indexes/base.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ class Index(IndexOpsMixin[S1]):
283283
@final
284284
def is_(self, other) -> bool: ...
285285
def __len__(self) -> int: ...
286-
def __array__(self, dtype=...) -> np.ndarray: ...
286+
def __array__(
287+
self, dtype: _str | np.dtype = ..., copy: bool | None = ...
288+
) -> np.ndarray: ...
287289
def __array_wrap__(self, result, context=...): ...
288290
@property
289291
def dtype(self) -> DtypeObj: ...
@@ -321,9 +323,9 @@ class Index(IndexOpsMixin[S1]):
321323
def names(self, names: Sequence[Hashable]) -> None: ...
322324
def set_names(self, names, *, level=..., inplace: bool = ...): ...
323325
@overload
324-
def rename(self, name, inplace: Literal[False] = False) -> Self: ...
326+
def rename(self, name, *, inplace: Literal[False] = False) -> Self: ...
325327
@overload
326-
def rename(self, name, inplace: Literal[True]) -> None: ...
328+
def rename(self, name, *, inplace: Literal[True]) -> None: ...
327329
@property
328330
def nlevels(self) -> int: ...
329331
def get_level_values(self, level: int | _str) -> Index: ...

pandas-stubs/core/indexes/category.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate):
3838
def __array__(
3939
self, dtype: DtypeArg = ..., copy: bool | None = ...
4040
) -> np.ndarray: ...
41-
def fillna(self, value=...): ...
4241
@property
4342
def is_unique(self) -> bool: ...
4443
@property

pandas-stubs/core/indexes/datetimes.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class DatetimeIndex(DatetimeTimedeltaMixin[Timestamp], DatetimeIndexProperties):
5656
copy: bool = ...,
5757
name: Hashable = ...,
5858
) -> None: ...
59-
def __array__(self, dtype=...) -> np.ndarray: ...
6059
def __reduce__(self): ...
6160
# various ignores needed for mypy, as we do want to restrict what can be used in
6261
# arithmetic for these types

pandas-stubs/core/indexes/interval.pyi

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,7 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
221221
def memory_usage(self, deep: bool = False) -> int: ...
222222
@property
223223
def is_overlapping(self) -> bool: ...
224-
# Note: tolerance no effect. It is included in all get_loc so
225-
# that signatures are consistent with base even though it is usually not used
226-
def get_loc(
227-
self,
228-
key: Label,
229-
method: FillnaOptions | Literal["nearest"] | None = ...,
230-
tolerance=...,
231-
) -> int | slice | npt.NDArray[np.bool_]: ...
224+
def get_loc(self, key: Label) -> int | slice | npt.NDArray[np.bool_]: ...
232225
@final
233226
def get_indexer(
234227
self,

0 commit comments

Comments
 (0)