BUG: clip should handle null values · Issue #17276 · pandas-dev/pandas (original) (raw)

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