Skip to content

Commit 017c72c

Browse files
authored
TYP/CLN: remove no-longer-needed overrides (#52007)
* TYP/CLN: remove no-longer-needed overrides * update code_checks
1 parent 0163b41 commit 017c72c

File tree

4 files changed

+15
-500
lines changed

4 files changed

+15
-500
lines changed

ci/code_checks.sh

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9797
pandas.Series.is_monotonic_increasing \
9898
pandas.Series.is_monotonic_decreasing \
9999
pandas.Series.backfill \
100+
pandas.Series.bfill \
101+
pandas.Series.ffill \
100102
pandas.Series.pad \
101103
pandas.Series.argsort \
102104
pandas.Series.reorder_levels \
@@ -541,6 +543,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
541543
pandas.DataFrame.iterrows \
542544
pandas.DataFrame.pipe \
543545
pandas.DataFrame.backfill \
546+
pandas.DataFrame.bfill \
547+
pandas.DataFrame.ffill \
544548
pandas.DataFrame.pad \
545549
pandas.DataFrame.swapaxes \
546550
pandas.DataFrame.first_valid_index \

pandas/core/frame.py

+8-234
Original file line numberDiff line numberDiff line change
@@ -6808,14 +6808,13 @@ def sort_values(
68086808
elif len(by):
68096809
# len(by) == 1
68106810

6811-
by = by[0]
6812-
k = self._get_label_or_level_values(by, axis=axis)
6811+
k = self._get_label_or_level_values(by[0], axis=axis)
68136812

68146813
# need to rewrap column in Series to apply key function
68156814
if key is not None:
68166815
# error: Incompatible types in assignment (expression has type
68176816
# "Series", variable has type "ndarray")
6818-
k = Series(k, name=by) # type: ignore[assignment]
6817+
k = Series(k, name=by[0]) # type: ignore[assignment]
68196818

68206819
if isinstance(ascending, (tuple, list)):
68216820
ascending = ascending[0]
@@ -11405,8 +11404,7 @@ def quantile(
1140511404
keys = [data._get_label_or_level_values(x) for x in by]
1140611405
indexer = lexsort_indexer(keys)
1140711406
else:
11408-
by = by[0]
11409-
k = data._get_label_or_level_values(by) # type: ignore[arg-type]
11407+
k = data._get_label_or_level_values(by[0])
1141011408
indexer = nargsort(k)
1141111409

1141211410
res = data._mgr.take(indexer[q_idx], verify=False)
@@ -11686,10 +11684,12 @@ def isin(self, values: Series | DataFrame | Sequence | Mapping) -> DataFrame:
1168611684
# error: Argument 2 to "isin" has incompatible type "Union[Sequence[Any],
1168711685
# Mapping[Any, Any]]"; expected "Union[Union[ExtensionArray,
1168811686
# ndarray[Any, Any]], Index, Series]"
11687+
res_values = algorithms.isin(
11688+
self.values.ravel(),
11689+
values, # type: ignore[arg-type]
11690+
)
1168911691
result = self._constructor(
11690-
algorithms.isin(
11691-
self.values.ravel(), values # type: ignore[arg-type]
11692-
).reshape(self.shape),
11692+
res_values.reshape(self.shape),
1169311693
self.index,
1169411694
self.columns,
1169511695
copy=False,
@@ -11815,232 +11815,6 @@ def values(self) -> np.ndarray:
1181511815
"""
1181611816
return self._mgr.as_array()
1181711817

11818-
@overload
11819-
def ffill(
11820-
self,
11821-
*,
11822-
axis: None | Axis = ...,
11823-
inplace: Literal[False] = ...,
11824-
limit: None | int = ...,
11825-
downcast: dict | None = ...,
11826-
) -> DataFrame:
11827-
...
11828-
11829-
@overload
11830-
def ffill(
11831-
self,
11832-
*,
11833-
axis: None | Axis = ...,
11834-
inplace: Literal[True],
11835-
limit: None | int = ...,
11836-
downcast: dict | None = ...,
11837-
) -> None:
11838-
...
11839-
11840-
@overload
11841-
def ffill(
11842-
self,
11843-
*,
11844-
axis: None | Axis = ...,
11845-
inplace: bool = ...,
11846-
limit: None | int = ...,
11847-
downcast: dict | None = ...,
11848-
) -> DataFrame | None:
11849-
...
11850-
11851-
def ffill(
11852-
self,
11853-
*,
11854-
axis: None | Axis = None,
11855-
inplace: bool = False,
11856-
limit: None | int = None,
11857-
downcast: dict | None = None,
11858-
) -> DataFrame | None:
11859-
return super().ffill(axis=axis, inplace=inplace, limit=limit, downcast=downcast)
11860-
11861-
@overload
11862-
def bfill(
11863-
self,
11864-
*,
11865-
axis: None | Axis = ...,
11866-
inplace: Literal[False] = ...,
11867-
limit: None | int = ...,
11868-
downcast=...,
11869-
) -> DataFrame:
11870-
...
11871-
11872-
@overload
11873-
def bfill(
11874-
self,
11875-
*,
11876-
axis: None | Axis = ...,
11877-
inplace: Literal[True],
11878-
limit: None | int = ...,
11879-
downcast=...,
11880-
) -> None:
11881-
...
11882-
11883-
@overload
11884-
def bfill(
11885-
self,
11886-
*,
11887-
axis: None | Axis = ...,
11888-
inplace: bool = ...,
11889-
limit: None | int = ...,
11890-
downcast=...,
11891-
) -> DataFrame | None:
11892-
...
11893-
11894-
def bfill(
11895-
self,
11896-
*,
11897-
axis: None | Axis = None,
11898-
inplace: bool = False,
11899-
limit: None | int = None,
11900-
downcast=None,
11901-
) -> DataFrame | None:
11902-
return super().bfill(axis=axis, inplace=inplace, limit=limit, downcast=downcast)
11903-
11904-
def clip(
11905-
self: DataFrame,
11906-
lower: float | None = None,
11907-
upper: float | None = None,
11908-
*,
11909-
axis: Axis | None = None,
11910-
inplace: bool = False,
11911-
**kwargs,
11912-
) -> DataFrame | None:
11913-
return super().clip(lower, upper, axis=axis, inplace=inplace, **kwargs)
11914-
11915-
def interpolate(
11916-
self: DataFrame,
11917-
method: str = "linear",
11918-
*,
11919-
axis: Axis = 0,
11920-
limit: int | None = None,
11921-
inplace: bool = False,
11922-
limit_direction: str | None = None,
11923-
limit_area: str | None = None,
11924-
downcast: str | None = None,
11925-
**kwargs,
11926-
) -> DataFrame | None:
11927-
return super().interpolate(
11928-
method=method,
11929-
axis=axis,
11930-
limit=limit,
11931-
inplace=inplace,
11932-
limit_direction=limit_direction,
11933-
limit_area=limit_area,
11934-
downcast=downcast,
11935-
**kwargs,
11936-
)
11937-
11938-
@overload
11939-
def where(
11940-
self,
11941-
cond,
11942-
other=...,
11943-
*,
11944-
inplace: Literal[False] = ...,
11945-
axis: Axis | None = ...,
11946-
level: Level = ...,
11947-
) -> DataFrame:
11948-
...
11949-
11950-
@overload
11951-
def where(
11952-
self,
11953-
cond,
11954-
other=...,
11955-
*,
11956-
inplace: Literal[True],
11957-
axis: Axis | None = ...,
11958-
level: Level = ...,
11959-
) -> None:
11960-
...
11961-
11962-
@overload
11963-
def where(
11964-
self,
11965-
cond,
11966-
other=...,
11967-
*,
11968-
inplace: bool = ...,
11969-
axis: Axis | None = ...,
11970-
level: Level = ...,
11971-
) -> DataFrame | None:
11972-
...
11973-
11974-
def where(
11975-
self,
11976-
cond,
11977-
other=lib.no_default,
11978-
*,
11979-
inplace: bool = False,
11980-
axis: Axis | None = None,
11981-
level: Level = None,
11982-
) -> DataFrame | None:
11983-
return super().where(
11984-
cond,
11985-
other,
11986-
inplace=inplace,
11987-
axis=axis,
11988-
level=level,
11989-
)
11990-
11991-
@overload
11992-
def mask(
11993-
self,
11994-
cond,
11995-
other=...,
11996-
*,
11997-
inplace: Literal[False] = ...,
11998-
axis: Axis | None = ...,
11999-
level: Level = ...,
12000-
) -> DataFrame:
12001-
...
12002-
12003-
@overload
12004-
def mask(
12005-
self,
12006-
cond,
12007-
other=...,
12008-
*,
12009-
inplace: Literal[True],
12010-
axis: Axis | None = ...,
12011-
level: Level = ...,
12012-
) -> None:
12013-
...
12014-
12015-
@overload
12016-
def mask(
12017-
self,
12018-
cond,
12019-
other=...,
12020-
*,
12021-
inplace: bool = ...,
12022-
axis: Axis | None = ...,
12023-
level: Level = ...,
12024-
) -> DataFrame | None:
12025-
...
12026-
12027-
def mask(
12028-
self,
12029-
cond,
12030-
other=lib.no_default,
12031-
*,
12032-
inplace: bool = False,
12033-
axis: Axis | None = None,
12034-
level: Level = None,
12035-
) -> DataFrame | None:
12036-
return super().mask(
12037-
cond,
12038-
other,
12039-
inplace=inplace,
12040-
axis=axis,
12041-
level=level,
12042-
)
12043-
1204411818

1204511819
DataFrame._add_numeric_operations()
1204611820

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12033,7 +12033,7 @@ def ewm(
1203312033
# Arithmetic Methods
1203412034

1203512035
@final
12036-
def _inplace_method(self, other, op):
12036+
def _inplace_method(self, other, op) -> Self:
1203712037
"""
1203812038
Wrap arithmetic method to operate inplace.
1203912039
"""

0 commit comments

Comments
 (0)