BUG: clip where the bound is a series with NA values returns NA · Issue #40420 · pandas-dev/pandas (original) (raw)
In [1]: import pandas as pd
In [2]: pd.__version__
Out[2]: '1.2.3'
In [3]: tmp = pd.DataFrame({'f': [1,2]})
In [4]: import numpy as np
In [5]: tmp['h'] = np.nan
#This is the expected behaviour
In [6]: tmp['f'].clip(0, np.inf)
Out[6]:
0 1
1 2
Name: f, dtype: int64
# This seems wrong:
In [7]: tmp['f'].clip(0, tmp['h'])
Out[7]:
0 NaN
1 NaN
Name: f, dtype: float64