Python Forum
Error: Slicing a single date from Pandas
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: Slicing a single date from Pandas
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pandas read csv file in 'date/time' chunks MorganSamage 4 1,647 Feb-13-2023, 11:24 AM
Last Post: MorganSamage
  pip install pandas ERROR pythondudu 7 32,930 May-24-2022, 06:14 AM
Last Post: Marya_475
  Does a pandas have a date without a time? AlekseyPython 6 4,866 Feb-10-2021, 09:24 AM
Last Post: Naheed
  strange error from pandas dataframe djf123 1 4,002 Jul-27-2020, 05:25 AM
Last Post: scidam
  error bars with dataframe and pandas Hucky 4 4,146 Apr-27-2020, 02:02 AM
Last Post: Hucky
  replace nan values by mean group by date.year, date.month wissam1974 5 8,327 Feb-19-2020, 06:25 PM
Last Post: AnkitGupta
  Obtaining Correct Date In Pandas DataFrame eddywinch82 14 5,850 Feb-17-2020, 11:45 AM
Last Post: eddywinch82
  pandas error Scott 2 6,178 Feb-05-2020, 07:22 PM
Last Post: Scott
  Trying to Pass date to pandas search from input prompt curranjohn46 1 2,072 Oct-10-2019, 10:01 AM
Last Post: curranjohn46
  Need help passing date to pandas query curranjohn46 1 5,419 Oct-10-2019, 09:59 AM
Last Post: curranjohn46

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020