df.were(),df.mask()
df.where(cond,other...) df.mask()
df.where将series中不满足cond的那些值替换为other
df.mask()结果与where()相反
In [45]:
df['loan_amnt'].head(10).where(df['loan_amnt']<5000,5000)
Out[45]:
In [46]:
df['loan_amnt'].head(10).mask(df['loan_amnt']<5000,5000)
Out[46]: