Skip to content

TYP return type of DataFrame.clip not correct #40829

Closed
@MarcoGorelli

Description

@MarcoGorelli

pandas/pandas/core/generic.py

Lines 7449 to 7458 in 094f630

@final
def clip(
self: FrameOrSeries,
lower=None,
upper=None,
axis=None,
inplace: bool_t = False,
*args,
**kwargs,
) -> FrameOrSeries:

Return type should be Optional[FrameOrSeriesUnion]

It could also do with being overloaded according to the value of inplace - see set_axis and DataFrame.reset_index for examples

Metadata

Metadata

Labels

Typingtype annotations, mypy/pyright type checkinggood first issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions