pandas, python - how to select specific times in timeseries

后端 未结 4 1266
予麋鹿
予麋鹿 2020-12-12 17:58

I worked now for quite some time using python and pandas for analysing a set of hourly data and find it quite nice (Coming from Matlab.)

Now I am kind of stuck. I cr

4条回答
  •  不知归路
    2020-12-12 18:13

    In upcoming pandas 0.8.0, you'll be able to write

    hour = ts.index.hour
    selector = ((10 <= hour) & (hour <= 13)) | ((20 <= hour) & (hour <= 23))
    data = ts[selector]
    

提交回复
热议问题