def df_index_to_datetime(df, datetime_format):
    index_name = df.index.name
df = df.reset_index()
df[index_name] = df[index_name].map(lambda x: datetime.strptime(x,
    datetime_format))
df = df.set_index(index_name)
KeyError in pandas to_datetime using custom format