Selecting Data between Specific hours in a pandas dataframe

后端 未结 3 1848
灰色年华
灰色年华 2020-12-03 14:16

My Pandas Dataframe frame looks something like this

 1. 2013-10-09 09:00:05
 2. 2013-10-09 09:05:00
 3. 2013-10-09 10:00:00
 4.  ............
 5.   .........         


        
3条回答
  •  忘掉有多难
    2020-12-03 14:53

    Assuming your original dataframe is called "df" and your time column is called "time" this would work: (where start_time and end_time correspond to the time interval that you'd like)

    >>> df_new = df[(df['time'] > start_time) & (df['time'] < end_time)]
    

提交回复
热议问题