2
$\begingroup$

I have a data frame like this:

timestamp                  vote_count
00:12:30                   350 
05:05:00                   50 
01:10:35                   200 
05:05:00                   175 
..............................
..............................
00:12:30                   900

Now I want to visualize the vote_count for the timestamps and do some analysis on that further. How can I plot the two columns against each other using matplotlib or seaborn?

Note: The timestamp is in 24hr format. Also, at any timestamp, there can be multiple vote counts.

$\endgroup$
3
  • $\begingroup$ df=df.groupby('timestamp').sum() followed by df.plot(x='timestamp', y='vote_count') $\endgroup$
    – Emre
    Apr 30 '17 at 9:12
  • $\begingroup$ The provided documentation of both libraries should be more than enough for you to figure this out. $\endgroup$
    – h3h325
    Apr 30 '17 at 11:07
  • $\begingroup$ @Emre why don't you upgrade your comment into an answer? $\endgroup$
    – famargar
    May 3 '17 at 10:47
2
$\begingroup$

You need to groupby to deal with multiple vote counts:

df.groupby('timestamp').sum().plot(x='timestamp', y='vote_count')

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.