I am attempting to index a pandas dataframe by a column in the dataframe and get KeyError. For example, the dataframe has rows indexed on general ledger account name ('Cash','Securities', etc) and the columns are indexed by the time period ('Q1_2018', 'Q2_2018', etc.). These values are confirmed when I use df.index and df.columns. However, when i run df.loc['Cash','Q1_2018'], it returns the following KeyError: 'Q1_2018'. Any thoughts on why this would occur.
Q1_2018 Q2_2018 Q3_2018
Cash 2000000 2000100 1900000
Securites 3000000 2999900 2910000