Skip to content

Commit 83a3f6d

Browse files
Move drop overloads from series and df into generic.
1 parent 8621c71 commit 83a3f6d

File tree

3 files changed

+15
-233
lines changed

3 files changed

+15
-233
lines changed

pandas-stubs/core/frame.pyi

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -695,114 +695,6 @@ class DataFrame(NDFrame, OpsMixin):
695695
tolerance: float | None = ...,
696696
) -> DataFrame: ...
697697
@overload
698-
def drop(
699-
self,
700-
labels: None = ...,
701-
*,
702-
axis: Axis = ...,
703-
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
704-
columns: Hashable | Sequence[Hashable] | Index[Any],
705-
level: Level | None = ...,
706-
inplace: Literal[True],
707-
errors: IgnoreRaise = ...,
708-
) -> None: ...
709-
@overload
710-
def drop(
711-
self,
712-
labels: None = ...,
713-
*,
714-
axis: Axis = ...,
715-
index: Hashable | Sequence[Hashable] | Index[Any],
716-
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
717-
level: Level | None = ...,
718-
inplace: Literal[True],
719-
errors: IgnoreRaise = ...,
720-
) -> None: ...
721-
@overload
722-
def drop(
723-
self,
724-
labels: Hashable | Sequence[Hashable] | Index[Any],
725-
*,
726-
axis: Axis = ...,
727-
index: None = ...,
728-
columns: None = ...,
729-
level: Level | None = ...,
730-
inplace: Literal[True],
731-
errors: IgnoreRaise = ...,
732-
) -> None: ...
733-
@overload
734-
def drop(
735-
self,
736-
labels: None = ...,
737-
*,
738-
axis: Axis = ...,
739-
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
740-
columns: Hashable | Sequence[Hashable] | Index[Any],
741-
level: Level | None = ...,
742-
inplace: Literal[False] = ...,
743-
errors: IgnoreRaise = ...,
744-
) -> DataFrame: ...
745-
@overload
746-
def drop(
747-
self,
748-
labels: None = ...,
749-
*,
750-
axis: Axis = ...,
751-
index: Hashable | Sequence[Hashable] | Index[Any],
752-
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
753-
level: Level | None = ...,
754-
inplace: Literal[False] = ...,
755-
errors: IgnoreRaise = ...,
756-
) -> DataFrame: ...
757-
@overload
758-
def drop(
759-
self,
760-
labels: Hashable | Sequence[Hashable] | Index[Any],
761-
*,
762-
axis: Axis = ...,
763-
index: None = ...,
764-
columns: None = ...,
765-
level: Level | None = ...,
766-
inplace: Literal[False] = ...,
767-
errors: IgnoreRaise = ...,
768-
) -> DataFrame: ...
769-
@overload
770-
def drop(
771-
self,
772-
labels: None = ...,
773-
*,
774-
axis: Axis = ...,
775-
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
776-
columns: Hashable | Sequence[Hashable] | Index[Any],
777-
level: Level | None = ...,
778-
inplace: bool = ...,
779-
errors: IgnoreRaise = ...,
780-
) -> DataFrame | None: ...
781-
@overload
782-
def drop(
783-
self,
784-
labels: None = ...,
785-
*,
786-
axis: Axis = ...,
787-
index: Hashable | Sequence[Hashable] | Index[Any],
788-
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
789-
level: Level | None = ...,
790-
inplace: bool = ...,
791-
errors: IgnoreRaise = ...,
792-
) -> DataFrame | None: ...
793-
@overload
794-
def drop(
795-
self,
796-
labels: Hashable | Sequence[Hashable] | Index[Any],
797-
*,
798-
axis: Axis = ...,
799-
index: None = ...,
800-
columns: None = ...,
801-
level: Level | None = ...,
802-
inplace: bool = ...,
803-
errors: IgnoreRaise = ...,
804-
) -> DataFrame | None: ...
805-
@overload
806698
def rename(
807699
self,
808700
mapper: Renamer | None = ...,

pandas-stubs/core/generic.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ class NDFrame(indexing.IndexingMixin):
308308
labels: None = ...,
309309
*,
310310
axis: Axis = ...,
311-
index: Hashable | Sequence[Hashable] = ...,
312-
columns: Hashable | Sequence[Hashable],
311+
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
312+
columns: Hashable | Sequence[Hashable] | Index[Any],
313313
level: Level | None = ...,
314314
inplace: Literal[True],
315315
errors: IgnoreRaise = ...,
@@ -320,16 +320,16 @@ class NDFrame(indexing.IndexingMixin):
320320
labels: None = ...,
321321
*,
322322
axis: Axis = ...,
323-
index: Hashable | Sequence[Hashable],
324-
columns: Hashable | Sequence[Hashable] = ...,
323+
index: Hashable | Sequence[Hashable] | Index[Any],
324+
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
325325
level: Level | None = ...,
326326
inplace: Literal[True],
327327
errors: IgnoreRaise = ...,
328328
) -> None: ...
329329
@overload
330330
def drop(
331331
self,
332-
labels: Hashable | Sequence[Hashable],
332+
labels: Hashable | Sequence[Hashable] | Index[Any],
333333
*,
334334
axis: Axis = ...,
335335
index: None = ...,
@@ -344,8 +344,8 @@ class NDFrame(indexing.IndexingMixin):
344344
labels: None = ...,
345345
*,
346346
axis: Axis = ...,
347-
index: Hashable | Sequence[Hashable] = ...,
348-
columns: Hashable | Sequence[Hashable],
347+
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
348+
columns: Hashable | Sequence[Hashable] | Index[Any],
349349
level: Level | None = ...,
350350
inplace: Literal[False] = ...,
351351
errors: IgnoreRaise = ...,
@@ -356,16 +356,16 @@ class NDFrame(indexing.IndexingMixin):
356356
labels: None = ...,
357357
*,
358358
axis: Axis = ...,
359-
index: Hashable | Sequence[Hashable],
360-
columns: Hashable | Sequence[Hashable] = ...,
359+
index: Hashable | Sequence[Hashable] | Index[Any],
360+
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
361361
level: Level | None = ...,
362362
inplace: Literal[False] = ...,
363363
errors: IgnoreRaise = ...,
364364
) -> Self: ...
365365
@overload
366366
def drop(
367367
self,
368-
labels: Hashable | Sequence[Hashable],
368+
labels: Hashable | Sequence[Hashable] | Index[Any],
369369
*,
370370
axis: Axis = ...,
371371
index: None = ...,
@@ -380,8 +380,8 @@ class NDFrame(indexing.IndexingMixin):
380380
labels: None = ...,
381381
*,
382382
axis: Axis = ...,
383-
index: Hashable | Sequence[Hashable] = ...,
384-
columns: Hashable | Sequence[Hashable],
383+
index: Hashable | Sequence[Hashable] | Index[Any] = ...,
384+
columns: Hashable | Sequence[Hashable] | Index[Any],
385385
level: Level | None = ...,
386386
inplace: _bool = ...,
387387
errors: IgnoreRaise = ...,
@@ -392,16 +392,16 @@ class NDFrame(indexing.IndexingMixin):
392392
labels: None = ...,
393393
*,
394394
axis: Axis = ...,
395-
index: Hashable | Sequence[Hashable],
396-
columns: Hashable | Sequence[Hashable] = ...,
395+
index: Hashable | Sequence[Hashable] | Index[Any],
396+
columns: Hashable | Sequence[Hashable] | Index[Any] = ...,
397397
level: Level | None = ...,
398398
inplace: _bool = ...,
399399
errors: IgnoreRaise = ...,
400400
) -> Self | None: ...
401401
@overload
402402
def drop(
403403
self,
404-
labels: Hashable | Sequence[Hashable],
404+
labels: Hashable | Sequence[Hashable] | Index[Any],
405405
*,
406406
axis: Axis = ...,
407407
index: None = ...,

pandas-stubs/core/series.pyi

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ from pandas._typing import (
116116
FloatDtypeArg,
117117
GroupByObjectNonScalar,
118118
HashableT1,
119-
HashableT2,
120-
HashableT3,
121119
IgnoreRaise,
122120
IndexingInt,
123121
IndexLabel,
@@ -1052,114 +1050,6 @@ class Series(IndexOpsMixin[S1], NDFrame):
10521050
tolerance: float | None = ...,
10531051
) -> Self: ...
10541052
@overload
1055-
def drop(
1056-
self,
1057-
labels: None = ...,
1058-
*,
1059-
axis: Axis = ...,
1060-
index: Hashable | list[HashableT2] | Index = ...,
1061-
columns: Hashable | list[HashableT3] | Index,
1062-
level: Level | None = ...,
1063-
inplace: Literal[True],
1064-
errors: IgnoreRaise = ...,
1065-
) -> None: ...
1066-
@overload
1067-
def drop(
1068-
self,
1069-
labels: None = ...,
1070-
*,
1071-
axis: Axis = ...,
1072-
index: Hashable | list[HashableT2] | Index,
1073-
columns: Hashable | list[HashableT3] | Index = ...,
1074-
level: Level | None = ...,
1075-
inplace: Literal[True],
1076-
errors: IgnoreRaise = ...,
1077-
) -> None: ...
1078-
@overload
1079-
def drop(
1080-
self,
1081-
labels: Hashable | list[HashableT1] | Index,
1082-
*,
1083-
axis: Axis = ...,
1084-
index: None = ...,
1085-
columns: None = ...,
1086-
level: Level | None = ...,
1087-
inplace: Literal[True],
1088-
errors: IgnoreRaise = ...,
1089-
) -> None: ...
1090-
@overload
1091-
def drop(
1092-
self,
1093-
labels: None = ...,
1094-
*,
1095-
axis: Axis = ...,
1096-
index: Hashable | list[HashableT2] | Index = ...,
1097-
columns: Hashable | list[HashableT3] | Index,
1098-
level: Level | None = ...,
1099-
inplace: Literal[False] = ...,
1100-
errors: IgnoreRaise = ...,
1101-
) -> Self: ...
1102-
@overload
1103-
def drop(
1104-
self,
1105-
labels: None = ...,
1106-
*,
1107-
axis: Axis = ...,
1108-
index: Hashable | list[HashableT2] | Index,
1109-
columns: Hashable | list[HashableT3] | Index = ...,
1110-
level: Level | None = ...,
1111-
inplace: Literal[False] = ...,
1112-
errors: IgnoreRaise = ...,
1113-
) -> Self: ...
1114-
@overload
1115-
def drop(
1116-
self,
1117-
labels: Hashable | list[HashableT1] | Index,
1118-
*,
1119-
axis: Axis = ...,
1120-
index: None = ...,
1121-
columns: None = ...,
1122-
level: Level | None = ...,
1123-
inplace: Literal[False] = ...,
1124-
errors: IgnoreRaise = ...,
1125-
) -> Self: ...
1126-
@overload
1127-
def drop(
1128-
self,
1129-
labels: None = ...,
1130-
*,
1131-
axis: Axis = ...,
1132-
index: Hashable | list[HashableT2] | Index = ...,
1133-
columns: Hashable | list[HashableT3] | Index,
1134-
level: Level | None = ...,
1135-
inplace: bool = ...,
1136-
errors: IgnoreRaise = ...,
1137-
) -> Series | None: ...
1138-
@overload
1139-
def drop(
1140-
self,
1141-
labels: None = ...,
1142-
*,
1143-
axis: Axis = ...,
1144-
index: Hashable | list[HashableT2] | Index,
1145-
columns: Hashable | list[HashableT3] | Index = ...,
1146-
level: Level | None = ...,
1147-
inplace: bool = ...,
1148-
errors: IgnoreRaise = ...,
1149-
) -> Series | None: ...
1150-
@overload
1151-
def drop(
1152-
self,
1153-
labels: Hashable | list[HashableT1] | Index,
1154-
*,
1155-
axis: Axis = ...,
1156-
index: None = ...,
1157-
columns: None = ...,
1158-
level: Level | None = ...,
1159-
inplace: bool = ...,
1160-
errors: IgnoreRaise = ...,
1161-
) -> Series | None: ...
1162-
@overload
11631053
def fillna(
11641054
self,
11651055
value: Scalar | NAType | dict | Series[S1] | DataFrame | None = ...,

0 commit comments

Comments
 (0)