Reputation: 25
I have a time series data which contains date, year, month and ratings columns. I have grouped by year and month and and then i am counting the number of rating in each month for that year. I have done this the following way:
nightlife_ratings_mean = review_data_nightlife.groupby(['year','month'])['stars'].count()
I get the following data frame
year month
2005 8 3
9 4
10 16
11 13
12 7
2006 1 62
2 24
3 13
4 20
5 11
6 13
7 11
8 29
9 33
10 46
I want to plot this such that my x label is year and and y label is count and i want a line plot with marker-ø. How can I do this. I am trying this for the first time. So please help.
Upvotes: 0
Views: 148
Reputation: 769
You can call plot
on your DataFrame and include the option style = 'o-'
:
plt = nightlife_ratings_mean.plot(x = 'year', y = 'stars', style = 'o-', title = "Stars for each month and year")
plt.set_xlabel("[Year, Month]")
plt.set_ylabel("Stars")
This will plot the following:
Upvotes: 1