Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

boolean indexing datetime object | converting string to datetime object

#convert col fromt string to dt 
df['date_time'] = pd.to_datetime(df['date_time'])

#boolean indexing on column 
day = i_94.copy()[(df['date_time'].dt.hour >= time_val) & (df['date_time'].dt.hour < time_val)]
print(day.shape)
Source by app.dataquest.io #
 
PREVIOUS NEXT
Tagged: #boolean #indexing #datetime #object #converting #string #datetime #object
ADD COMMENT
Topic
Name
7+1 =