0

I have the following dataframe but am having a hard time accessing a specific row.

I've tried .loc with the date string but for some reason am having a really hard time figuring this out.

How can I access a specific record by date?

                    close        high         low        open      volume  \
symbol time                                                                     
SPY    2017-01-12  216.549143  216.558680  215.147191  215.881547  48079858.0   
       2017-01-13  216.081825  216.253493  214.546354  216.015066  47029340.0   
       2017-01-14  216.520532  216.873404  216.196271  216.234419  33441289.0   
       2017-01-18  215.814787  216.282104  215.347470  215.833861  34874542.0   
       2017-01-19  216.243956  216.301179  215.442841  216.053214  33340515.0   
       2017-01-20  215.490526  216.491920  214.975523  216.339327  37762597.0   
       2017-01-21  216.205808  216.787570  215.585897  216.205808  58009364.0  


print(data.index)

MultiIndex(levels=[['SPY'], [2017-01-12 00:00:00, 2017-01-13 00:00:00, 2017-01-14 00:00:00, 2017-01-18 00:00:00, 2017-01-19 00:00:00, 2017-01-20 00:00:00, 2017-01-21 00:00:00]],
           labels=[[0, 0, 0, 0, 0, 0, 0], [0, 1, 2, 3, 4, 5, 6]],
           names=['symbol', 'time'])

yellowandy
  • 89
  • 1
  • 1
  • 7
  • unable to recreate the dataframe from the data you have posted. can you paste the whole dataframe & what output you expect? – moys Aug 24 '19 at 07:52
  • @mohanys I've tried to update the dataframe to hopefully make it easier to re-create. All I'm trying to do is select a row(s) by a date or date range. – yellowandy Aug 25 '19 at 05:18

0 Answers0