pandas query on datetime

Solutions on MaxInterview for pandas query on datetime by the best coders in the world

showing results for - "pandas query on datetime"
Emma
23 Feb 2018
1from time import datetime
2
3date_start = datetime(year_start, month_start, day_start)
4date_end = datetime(year_end, month_end, day_end)
5
6# df is your pandas dataframe
7sel = df[(df['timestamp'] >= date_start) &\
8         (df['timestamp'] <= date_end)]
9
10# tested with
11# python 3.9.4
12# pandas 1.3.2