大熊猫:基于列值每10行提取一次

时间:2019-08-11 22:04:43

标签: python-3.x pandas

我具有以下熊猫数据框,我只想保留time = 0.1, 0.2, 0.3, 0.4 ... (every 0.1 second)

的行

enter image description here

我尝试使用下面的floor函数,但不适用于熊猫:

enter image description here

关于如何实现此目标的任何建议?谢谢!

2 个答案:

答案 0 :(得分:1)

我会做什么

big_frame[big_frame.time.mul(100)%10==0]

答案 1 :(得分:0)

我通过以下技巧弄清楚了:

import sys
epsilon = sys.float_info.epsilon
big_frame[(big_frame.time + epsilon)%0.1 < 0.005]