1

I have a dataframe using periodindex (daily) starting from 1992-01-03.

I am trying to call out the data using period index, like dataframe['1992-01-03'], but it returned an error message--Key Error:'1992-01-03'. However, it works well if I call out by year or month, e.g., dataframe['1992'], or dataframe['1992-01'].

I can call out the daily value by using dataframe.loc['1992-01-03'].

Can anyone briefly explain why this is happening?

NOnaMe
  • 27
  • 5

1 Answers1

1

Without .loc

dataframe['1992-01-03']

Is check the column

With .loc is search the index

dataframe.loc['1992-01-03']
BENY
  • 317,841
  • 20
  • 164
  • 234