0

I have data from a JSON file that I have opened up using pandas.

I want to create a simple trend line from this data, but am unable to use pandas .plot() function since these are timestamps

   d
0   2012-03-01 00:00:00
1   2012-03-01 00:00:00
2   2012-03-01 00:00:00
3   2012-03-01 00:00:00
4   2012-03-01 00:00:00
5   2012-03-01 00:00:00
6   2012-03-01 00:00:00
7   2012-03-01 00:00:00
8   2012-03-01 00:00:00
9   2012-03-01 00:00:00
10  2012-03-01 00:00:00
11  2012-03-01 00:00:00
12  2012-03-01 00:00:00
13  2012-03-01 00:00:00
14  2012-03-01 00:00:00
15  2012-03-01 00:00:00
16  2012-03-01 00:00:00
17  2012-03-01 00:00:00
18  2012-03-01 00:00:00
19  2012-03-01 00:00:00
20  2012-03-01 00:00:00
21  2012-03-01 00:00:00
22  2012-03-01 00:00:00
23  2012-03-01 00:00:00
24  2012-03-01 00:00:00
25  2012-03-01 00:00:00
26  2012-03-01 00:00:00
27  2012-03-01 00:00:00
28  2012-03-01 00:00:00
29  2012-03-01 00:00:00
               ...        
22417   2012-04-30 22:14:02
22418   2012-04-30 22:20:53
22419   2012-04-30 22:22:54
22420   2012-04-30 22:25:31
22421   2012-04-30 22:25:43
22422   2012-04-30 22:29:04

Not sure what sort of format I need to put these in. I would like to group by these timestamps as well to show frequency over the hour. Unsure how to do that, much more used to SQL

I am attempting to group my unique date-hour combinations with the following:

 logins.groupby(["stamp"]).count() 

but am not getting my count number to show up

madman
  • 153
  • 1
  • 4
  • 16
  • Is there more data? Because right now, it looks like you've posted a dataframe of 30 repeats of `2012-03-01 00:00:00` and nothing else... Not sure what kind of plot you'd want to get out of that! – sacuL Apr 06 '18 at 03:35
  • yes there ! there is a lot more, but these were the first 30 entries – madman Apr 06 '18 at 03:38
  • But what do you want to plot it against? What are you trying to show? – sacuL Apr 06 '18 at 03:39
  • i'd like to aggregate on frequency per hour, just added more of the data in the original question – madman Apr 06 '18 at 03:40
  • frequency per hour being the count of rows occuring in each hour? – sacuL Apr 06 '18 at 03:41
  • yea, more or less. i was thinking to group by each unique date-hour combination and get a count for frequency in that day. then plot date-hour vs count – madman Apr 06 '18 at 03:43
  • Possible duplicate of https://stackoverflow.com/questions/34814606/a-per-hour-histogram-of-datetime-using-pandas. – busybear Apr 06 '18 at 03:50

0 Answers0