Skip to content

BUG: clip where the bound is a series with NA values returns NA  #40420

Closed
@zhangyingmath

Description

@zhangyingmath
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

Metadata

Metadata

Labels

BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNumeric OperationsArithmetic, Comparison, and Logical operations

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions