Skip to content

BUG: clip should handle null values #17276

Closed
@jreback

Description

@jreback

We need treat a np.nan as a clip arg as None (which means don't clip on that side).
This makes tihngs more user friendly with no loss of generality.

In [1]: Series([1,2,3]).clip(np.nan)
ValueError: Cannot use an NA value as a clip threshold

this is easily fixed by inside .clip() by:

if isnull(lower):
    lower = None
if isnull(upper):
    upper = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions