Python Forum
Error: Slicing a single date from Pandas - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Error: Slicing a single date from Pandas (/thread-11708.html)



Error: Slicing a single date from Pandas - cheerful - Jul-22-2018

Dear Experts,

I am using Python 3.6 and Pandas. My data looks like this:

SPY
2014-10-31 0.024425
2014-11-28 0.026894
2014-12-31 -0.002519
2015-01-30 -0.030020
2015-02-27 0.057474
2015-03-31 -0.015816
2015-04-30 0.009595

I have tried the following codes to retrieve the date of 2015/01/30. All work except the last one.

logR[pd.datetime(2015, 1, 30):pd.datetime(2015, 1, 30):] ok
logR['2015/01/30':'2015/01/30'] ok
logR.loc['2015/01/30'] ok
logR.ix['2015/01/30'] ok but deprecated warning
logR['2015/01/30'] KeyError: '01/30/2015'

Whats wrong??

Thank you for your help
L