|
44 | 44 | DtypeArg,
|
45 | 45 | DtypeObj,
|
46 | 46 | FilePath,
|
| 47 | + IgnoreRaise, |
47 | 48 | IndexKeyFunc,
|
48 | 49 | IndexLabel,
|
49 | 50 | IntervalClosedType,
|
|
71 | 72 | )
|
72 | 73 | from pandas.util._decorators import (
|
73 | 74 | deprecate_kwarg,
|
| 75 | + deprecate_nonkeyword_arguments, |
74 | 76 | doc,
|
75 | 77 | rewrite_axis_style_signature,
|
76 | 78 | )
|
@@ -4270,16 +4272,59 @@ def reindex_like(
|
4270 | 4272 |
|
4271 | 4273 | return self.reindex(**d)
|
4272 | 4274 |
|
| 4275 | + @overload |
4273 | 4276 | def drop(
|
4274 | 4277 | self,
|
4275 |
| - labels=None, |
4276 |
| - axis=0, |
4277 |
| - index=None, |
4278 |
| - columns=None, |
4279 |
| - level=None, |
| 4278 | + labels: Hashable | list[Hashable] = ..., |
| 4279 | + *, |
| 4280 | + axis: Axis = ..., |
| 4281 | + index: Hashable | list[Hashable] = ..., |
| 4282 | + columns: Hashable | list[Hashable] = ..., |
| 4283 | + level: Level | None = ..., |
| 4284 | + inplace: Literal[True], |
| 4285 | + errors: IgnoreRaise = ..., |
| 4286 | + ) -> None: |
| 4287 | + ... |
| 4288 | + |
| 4289 | + @overload |
| 4290 | + def drop( |
| 4291 | + self: NDFrameT, |
| 4292 | + labels: Hashable | list[Hashable] = ..., |
| 4293 | + *, |
| 4294 | + axis: Axis = ..., |
| 4295 | + index: Hashable | list[Hashable] = ..., |
| 4296 | + columns: Hashable | list[Hashable] = ..., |
| 4297 | + level: Level | None = ..., |
| 4298 | + inplace: Literal[False] = ..., |
| 4299 | + errors: IgnoreRaise = ..., |
| 4300 | + ) -> NDFrameT: |
| 4301 | + ... |
| 4302 | + |
| 4303 | + @overload |
| 4304 | + def drop( |
| 4305 | + self: NDFrameT, |
| 4306 | + labels: Hashable | list[Hashable] = ..., |
| 4307 | + *, |
| 4308 | + axis: Axis = ..., |
| 4309 | + index: Hashable | list[Hashable] = ..., |
| 4310 | + columns: Hashable | list[Hashable] = ..., |
| 4311 | + level: Level | None = ..., |
| 4312 | + inplace: bool_t = ..., |
| 4313 | + errors: IgnoreRaise = ..., |
| 4314 | + ) -> NDFrameT | None: |
| 4315 | + ... |
| 4316 | + |
| 4317 | + @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"]) |
| 4318 | + def drop( |
| 4319 | + self: NDFrameT, |
| 4320 | + labels: Hashable | list[Hashable] = None, |
| 4321 | + axis: Axis = 0, |
| 4322 | + index: Hashable | list[Hashable] = None, |
| 4323 | + columns: Hashable | list[Hashable] = None, |
| 4324 | + level: Level | None = None, |
4280 | 4325 | inplace: bool_t = False,
|
4281 |
| - errors: str = "raise", |
4282 |
| - ): |
| 4326 | + errors: IgnoreRaise = "raise", |
| 4327 | + ) -> NDFrameT | None: |
4283 | 4328 |
|
4284 | 4329 | inplace = validate_bool_kwarg(inplace, "inplace")
|
4285 | 4330 |
|
@@ -4312,7 +4357,7 @@ def _drop_axis(
|
4312 | 4357 | labels,
|
4313 | 4358 | axis,
|
4314 | 4359 | level=None,
|
4315 |
| - errors: str = "raise", |
| 4360 | + errors: IgnoreRaise = "raise", |
4316 | 4361 | only_slice: bool_t = False,
|
4317 | 4362 | ) -> NDFrameT:
|
4318 | 4363 | """
|
@@ -5826,7 +5871,7 @@ def dtypes(self):
|
5826 | 5871 | return self._constructor_sliced(data, index=self._info_axis, dtype=np.object_)
|
5827 | 5872 |
|
5828 | 5873 | def astype(
|
5829 |
| - self: NDFrameT, dtype, copy: bool_t = True, errors: str = "raise" |
| 5874 | + self: NDFrameT, dtype, copy: bool_t = True, errors: IgnoreRaise = "raise" |
5830 | 5875 | ) -> NDFrameT:
|
5831 | 5876 | """
|
5832 | 5877 | Cast a pandas object to a specified dtype ``dtype``.
|
@@ -9139,7 +9184,7 @@ def _where(
|
9139 | 9184 | inplace=False,
|
9140 | 9185 | axis=None,
|
9141 | 9186 | level=None,
|
9142 |
| - errors="raise", |
| 9187 | + errors: IgnoreRaise = "raise", |
9143 | 9188 | ):
|
9144 | 9189 | """
|
9145 | 9190 | Equivalent to public method `where`, except that `other` is not
|
@@ -9278,7 +9323,7 @@ def where(
|
9278 | 9323 | inplace=False,
|
9279 | 9324 | axis=None,
|
9280 | 9325 | level=None,
|
9281 |
| - errors="raise", |
| 9326 | + errors: IgnoreRaise = "raise", |
9282 | 9327 | try_cast=lib.no_default,
|
9283 | 9328 | ):
|
9284 | 9329 | """
|
@@ -9431,7 +9476,7 @@ def mask(
|
9431 | 9476 | inplace=False,
|
9432 | 9477 | axis=None,
|
9433 | 9478 | level=None,
|
9434 |
| - errors="raise", |
| 9479 | + errors: IgnoreRaise = "raise", |
9435 | 9480 | try_cast=lib.no_default,
|
9436 | 9481 | ):
|
9437 | 9482 |
|
|
0 commit comments