在日期框架上与函数进行交互 [英] interacting over a dateframe with functions
本文介绍了在日期框架上与函数进行交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有这样一个日期框架: N
if I have a date frame like this: N
EG_00_04 NEG_04_08 NEG_08_12 NEG_12_16 NEG_16_20 NEG_20_24 \
datum_von
2017-10-12 21.69 15.36 0.87 1.42 0.76 0.65
2017-10-13 11.85 8.08 1.39 2.86 1.02 0.55
2017-10-14 7.83 5.88 1.87 2.04 2.29 2.18
2017-10-15 14.64 11.28 2.62 3.35 2.13 1.25
2017-10-16 5.11 5.82 -0.30 -0.38 -0.24 -0.10
2017-10-17 12.09 9.61 0.20 1.09 0.39 0.57
我想检查大于0的值,并在它们较低时将其更改为零.
And I wanna check the values that are above 0 and change them to zero when they are lower.
不确定如何使用iterrows()函数和loc()函数.
Not sure how should I use the function iterrows() and the loc() function to do so.
推荐答案
clip_lower
and mask
solutions are good.
这是另一个具有 applymap
:
Here is another one with applymap
:
df.applymap(lambda x: max(0.0, x))
这篇关于在日期框架上与函数进行交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文