📜  文件“pandas _libs index.pyx”,第 465 行,在 pandas._libs.index.DatetimeEngine.get_loc KeyError: Timestamp('2019-01-02 07:09:00') - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:52.214000             🧑  作者: Mango

代码示例1
#check if DatetimeIndex
print (df_temp.index)

#if necessary convert column to index
df_temp.set_index('date',inplace=True) 
#if necessary convert to datetimes
df_temp.index= pd.to_datetime(df_temp.index)

loc = df_temp.index.get_loc('2015-08-17')