I have a dataframe
in Python
with two columns: StartTime
and StopTime
. In one of the operations, I need to group the data per day ( StartTime
). For this I need to eliminate hours, minutes, seconds from that column ...
The data you currently have is this way:
StartTime
2019-09-01 20:47:50
2019-09-01 22:47:50
2019-09-02 20:47:50
And I want you to stay:
StartTime
2019-09-01
2019-09-01
2019-09-02
To finally group and count the number of observations per day. In R
it is very simple with as_date()
and then grouping by StartTime
and adding a column with n()
.
I can not find the way to do it with Python
and pandas
.