Python 2.7, spyder, all packages installed by Anaconda. The code runs good befor upgrade to pandas 0.20.3
Trying to index two dataframes, days and udly, with unicode string date '2017-09-13'
they both have same index
udly.index[-1]
Out[13]: Timestamp('2017-09-13 00:00:00')
days.index[-1]
Out[14]: Timestamp('2017-09-13 00:00:00')
while indexing dataframe udly, everything goes well
udly['2017-09-13']
Out[15]:
CLOSE VOLUME ytm_1 ATMstk
2017-09-13 2.739 307060583.0 3.4912 2.75
But when index dataframe days, things goes tricky
days['2017-09-13']
Traceback (most recent call last):
...........
File "pandas\_libs\index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5280)
File "pandas\_libs\index.pyx", line 154, in pandas._libs.index.IndexEngine.get_loc (pandas\_libs\index.c:5126)
File "pandas\_libs\hashtable_class_helper.pxi", line 1210, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20523)
File "pandas\_libs\hashtable_class_helper.pxi", line 1218, in pandas._libs.hashtable.PyObjectHashTable.get_item (pandas\_libs\hashtable.c:20477)
KeyError: '2017-09-13'
Update
Indexing with .loc works, but returns me a Pandas.Series, but I would really like to know the reason why this happens, why I cannot index a dataframe.
type(udly['2017-09-13'])
Out[23]: pandas.core.frame.DataFrame
type(days.loc['2017-09-13'])
Out[24]: pandas.core.series.Series
even trickier part is that I can index dataframe days with partical index such as '2017-09' and it works, but I really need to index a specific day.
days['2017-09']
Out[39]:
2017-09-11 2017-09-11
2017-09-12 2017-09-12
2017-09-13 2017-09-13