2

I have a DataFrame that is based on a DateTimeIndex. I only want the hourly data and it is every 5 minutes unless there are some drop outs in the data. I think what I need to use is df.resample('1H'), but this automatically does df.resample('1H').mean(). I just want the hourly samples exactly the way they are. Does anyone know to to achieve this?

Thanks, Matthew

fatalaccidents
  • 192
  • 1
  • 2
  • 13
  • 1
    I think `df.resample('H').asfreq()`. Your question is very unclear though. Show a representative sample of your dataframe and your desired result. – Paul H Feb 03 '17 at 18:15

1 Answers1

2

You want last

df.resample('1H').last()

And as PaulH eluded to

df.asfreq('H')

Should also work

piRSquared
  • 285,575
  • 57
  • 475
  • 624
  • df.resample('1H').last() did not work, but as long as it was on the hour (exactly 8:00 or 9:00, etc) df.asfreq('H') worked for me. – fatalaccidents Feb 03 '17 at 20:14