python - Equality operation does not work for Pandas dataframe value in one or more cells but work for others
问题描述
I am working with dataframes read from csv file using pandas. I wanted to do some equality operation to find the rows where the column is of a specific value. However, it seems that the equality operation works for some numbers but not for others.
sample[sample['Time'] == 34200.045021468].index
Out[68]: Int64Index([], dtype='int64')
sample.loc[40, ['Time']]
Out[69]:
Time 34200.045021468
Name: 40, dtype: float64
sample[sample['Time'] == 34200.647527227].index
Out[71]: Int64Index([170, 171, 172, 173, 174], dtype='int64')
I have not tried for all values but when I tried to search for the value 34,200.045021468, it did not find anything but as can be seen it does exist in my dataframe.
On the other hand, when I do the same operation for another value, 34,200.647527227, it works?!
Can anyone kindly advise on what is wrong and how it can be fixed? Thank you in advance
解决方案
推荐阅读
- c++ - 在图表上执行 BFS 后,值顺序不符合预期?
- php - 来自 PHP 中的查询的 MySQL 查询
- java - 使用一种方法的结果以另一种方法计算价格
- javascript - 使用javascript的缺失数组的长度
- python - 如何在 Django RestFramework 中处理 PUT 请求
- r - R 有光泽;在渲染中全局定义 NA 行为
- c - 在这个 C 程序中,第二个 scanf 被跳过,如果我使用 fflush 那么它工作正常。为什么会这样?
- php - 在 PHP 中从没有源链接的字符串中删除锚标记
- c - “(数据类型)(*ptrname)(数据类型)”是什么意思?
- python - “for”循环如何在 2D 列表中工作?