0

So I have a dataframe with the index and a column named 0 image1

When I search for the index value of all the rows equal to '0' with df.index[df[0] == 0].tolist() It is working no problem image2

When I search for the index value of a row equal to a specific value such as '0.000376' with df.index[df[0] == 0.000376].tolist(). The output gives me nothing eventhough this value does exist in the data set. image3

Must be veeery basic but yeah I've been stuck on this for 2 days lol

Lorenz
  • 13
  • 2

1 Answers1

0

This is due to floating point approximation, use:

import numpy as np
df.index[np.isclose(df[0], 0.000376)].tolist()
mozway
  • 194,879
  • 13
  • 39
  • 75