I went into a problem when I round the timestamp to the nearest 15mins and append back to the dataframe, HMS wont show up, only showing the date. How do I fix it?
Orginal dataset:
uid timestamp loc app_id traffic
2807379 941 2016-04-20 00:00:00 6049 2 0.001
2817702 942 2016-04-20 00:00:03 9803 350 0.001
2817701 942 2016-04-20 00:00:03 6406 15 0.000
424540 325 2016-04-20 00:00:03 2654 127 0.001
Round to the closest 15 min interval by:
round_15_min = usage["timestamp"].dt.round("15min")
print out round_15_min
:
2807379 2016-04-20 00:00:00
2817702 2016-04-20 00:00:00
2817701 2016-04-20 00:00:00
424540 2016-04-20 00:00:00
However when append back to original dataset it became:
uid timestamp loc app_id traffic rounded_timestamp
2807379 941 2016-04-20 00:00:00 6049 2 0.001 2016-04-20
2817702 942 2016-04-20 00:00:03 9803 350 0.001 2016-04-20
2817701 942 2016-04-20 00:00:03 6406 15 0.000 2016-04-20
424540 325 2016-04-20 00:00:03 2654 127 0.001 2016-04-20
dtype from datetime64[ns]
became dtype('<m8[ns]')
How do I fix this problem? To make it show HMS?