pandas where 用法

 s = pd.Series(range(5))
0    0
1    1
2    2
3    3
4    4
dtype: int64
s.where(s >= 1, 10)

大于等于1的值不动,小于1的值替换成10

0    10
1     1
2     2
3     3
4     4
dtype: int64
posted @ 2022-08-19 22:53  luoganttcc  阅读(24)  评论(0)    收藏  举报