Arranging multiple dates and times

Hi everyone,

I am kinda new to R and would be needing your help on a issue.

The dataset I have is such that I have a csv file with 1 row in which the date and time is given. It looks something like this:

12-3-2018 08:51
12-3-2018 08:36
12-3-2018 09:21
12-3-2018 11:32

The dataset has almost 200.000 rows and some dates and times are identical. What I want to do is to look the data something like this:

Date and Time (dd-mm-yyyy)      Amount of times
12-3-2018 08:36                          2
12-3-2018 08:51                          4
12-3-2018 09:21                          3
12-3-2018 11:32                          2

So I want to order all the dates (13th comes after 12th and so on) and I want to write the amount of times the data and time was seen next to it.

Can you please suggest some methods?

Thank you very much in advance!


Hi @RCstudent

Try creating a dataframe from the csv file using pandas and then you can groupby date column and use aggregate function count on the same.
Please find the below link with more descriptive approach and actual python code to write the same .

© Copyright 2013-2019 Analytics Vidhya