I have a dataframe with two time columns : df['START TIME'] and df['END TIME']
Both these columns have datetime.time values or nan(float). I want to go row by row in both these columns and check, if the value is datetime.time, then floor it, otherwise pass.
This is the command I wrote in loop to floor the time :
df.loc[0,'START TIME'].dt.floor()
This gives an Attribute error :
AttributeError: 'datetime.time' object has no attribute 'dt'
When I check the type of df.loc[0,'START TIME'], it says datetime.time
In[116]: type(df.loc[0,'START TIME'])
Out[116]: datetime.time
I need to convert time like the following :
if time = 22:05:29, then new_time = 22:00:00
if time = 22:26:32, then new_time = 22:00:00
if time = 22:31:17, then new_time = 23:00:00
Where am I going wrong? any help would be much appreciated!