-2

I have the following pandas data frame and I only want to keep rows that time = 0.1, 0.2, 0.3, 0.4 ... (every 0.1 second)

enter image description here

I tried to use the floor function like below, but it doesn't work with pandas:

enter image description here

Any suggestions on how to achieve this? Thanks!

Edamame
  • 23,718
  • 73
  • 186
  • 320
  • 1
    This is not the way to ask a pandas question. First of all we [cannot copy & paste](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) you picture. Second, include a small example dataset and based on that example dataset an expected output. So we can visually see what you try to do. [Link](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – Erfan Aug 11 '19 at 22:09
  • `big_frame.time` refers to the column if i’m correct – Axiumin_ Aug 11 '19 at 22:18
  • @Axium Yes. big_frame.time is a column – Edamame Aug 11 '19 at 22:19

2 Answers2

1

What I will do

big_frame[big_frame.time.mul(100)%10==0]
BENY
  • 317,841
  • 20
  • 164
  • 234
0

I figured it out by doing the following trick:

import sys
epsilon = sys.float_info.epsilon
big_frame[(big_frame.time + epsilon)%0.1 < 0.005]
Edamame
  • 23,718
  • 73
  • 186
  • 320