小编La-*_*Low的帖子

'不再支持将类似列表的文件传递给 .loc 或 [] 缺少任何标签,请参阅

如何修复错误:

KeyError: 'Passing list-likes to .loc or [] with any missing labels 
is no longer supported, see 
https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike'
Run Code Online (Sandbox Code Playgroud)

我只想获取数据框的位置,即索引“ix”中的位置。

这是一个可重复的示例:

import pandas as pd
ix = pd.DatetimeIndex(["2019-07-19 08:47:00", "2019-07-19 08:48:00", "2019-07-19 08:49:00", '2019-07-19 13:43:00', '2019-07-19 13:44:00', '2019-07-19 13:45:00', '2019-07-19 13:46:00', '2019-07-19 13:47:00', '2019-07-19 13:48:00', '2019-07-19 13:49:00', '2019-07-19 13:50:00', '2019-07-19 13:51:00', '2019-07-19 13:52:00'], dtype='datetime64[ns]', name='Time', freq=None)
df = pd.DataFrame({"result":[7.445043,0.585584,1.735565,3.217186, 0.211871,0.000000,0.180448,21.645403,22.724170,304.292450]}, index = [
"2019-07-19 08:47:00", "2019-07-19 08:48:00", "2019-07-19 08:49:00", "2019-07-19 08:50:00", "2019-07-19 08:51:00", "2019-07-19 08:52:00",  "2019-07-19 08:53:00", "2019-07-19 08:54:00",   "2019-07-19 08:55:00", …
Run Code Online (Sandbox Code Playgroud)

python error-handling datetime dataframe pandas

3
推荐指数
1
解决办法
3401
查看次数

标签 统计

dataframe ×1

datetime ×1

error-handling ×1

pandas ×1

python ×1