Python3+pandasで小数点3桁での検索が正常に行なえません。
ご教授お願いします。
小数点3桁では正常に検索が行なえません。
Python
1In: 2df = pd.read_csv("test.csv") 3df.head(10) 4Out: 5 timestamp x 60 2018-02-01 00:01:00 0.010 71 2018-02-01 00:02:00 0.007 82 2018-02-01 00:03:00 0.006 93 2018-02-01 00:04:00 0.007 104 2018-02-01 00:05:00 0.007 11 12In: 13df = df.loc[df['x'] == 0.007] 14df.head(10) 15Out: 16timestamp x
2桁までは正常に検索が行えます
Python
1In: 2df = pd.read_csv("test2.csv") 3df.head(10) 4Out: 5 timestamp x 60 2018-02-01 00:01:00 0.01 71 2018-02-01 00:02:00 0.07 82 2018-02-01 00:03:00 0.06 93 2018-02-01 00:04:00 0.07 104 2018-02-01 00:05:00 0.07 11 12In: 13df = df.loc[df['x'] == 0.07] 14df.head(10) 15Out: 16timestamp x 171 2018-02-01 00:02:00 0.07 183 2018-02-01 00:04:00 0.07 194 2018-02-01 00:05:00 0.07
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。