Skip to content

TYP: Use Self instead of class-bound TypeVar (generic.py/frame.py/series.py) #51493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
ReadBuffer,
Renamer,
Scalar,
Self,
SortKind,
StorageOptions,
Suffixes,
Expand Down Expand Up @@ -2491,7 +2492,7 @@ def _from_arrays(
index,
dtype: Dtype | None = None,
verify_integrity: bool = True,
) -> DataFrame:
) -> Self:
"""
Create DataFrame from a list of arrays corresponding to the columns.

Expand Down Expand Up @@ -4590,7 +4591,7 @@ def eval(self, expr: str, *, inplace: bool = False, **kwargs) -> Any | None:

return _eval(expr, inplace=inplace, **kwargs)

def select_dtypes(self, include=None, exclude=None) -> DataFrame:
def select_dtypes(self, include=None, exclude=None) -> Self:
"""
Return a subset of the DataFrame's columns based on the column dtypes.

Expand Down Expand Up @@ -5008,7 +5009,7 @@ def align(
limit: int | None = None,
fill_axis: Axis = 0,
broadcast_axis: Axis | None = None,
) -> tuple[DataFrame, NDFrameT]:
) -> tuple[Self, NDFrameT]:
return super().align(
other,
join=join,
Expand Down
Loading