title: matplotlib bar graph from a pandas series of value counts
body: <p>I am trying to plot a graph in python which would show me the occurrence of items over time.
  So I want to find out how many items that match two categories appear in each year and plot a graph based on these.</p>
  <p>This is my data in excel:</p>
  <p><a href="https://i.stack.imgur.com/mkne4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mkne4.png" alt="enter image description here" /></a></p>
  <p>What I want to end up with is a list of movies which are both fantasy and action and how many times they appear in every year.
  This is the end result which I have gotten to (which is correct)</p>
  <p><a href="https://i.stack.imgur.com/alO73.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/alO73.png" alt="enter image description here" /></a></p>
  <p>i.e. there are 2 movies in 2004 which are both fantasy and action and there is one movie in 2005 which is both fantasy and action etc.</p>
  <p>Here are the steps which I have taken to get to the result:</p>
  <pre><code>#import data:
  data = pd.read_csv(&quot;data.csv&quot;)
  
  #put all fantasy movies in a list:
  fantasy_movies = data[['Name', 'Genre']][(data['Genre'] == 'Fantasy')]
  fantasy_movies.rename(columns={'Genre' : 'Fantasy'}, inplace = True)
  
  #put all action movies in a list:
  action_movies = data[['Name', 'Genre']][(data['Genre'] == 'Action')]
  action_movies.rename(columns={'Genre' : 'Action'}, inplace = True)
  
  #merge the two datasets:
  action_fantasy = pd.merge(fantasy_movies, action_movies)
  
  #obtain a list of unique movie names:
  unique = action_fantasy.Name.unique()
  
  #make dates the column and unique names the rows
  filter_data = data[(data.Name.isin(unique))] 
  table = filter_data.pivot_table(filter_data, index = ['Name'],columns=['year'])
  
  #replace all NaNs with zero
  table1 = table.fillna(0)
  
  #Count items in years
  table1.gt(0).astype(int).sum(axis=0)
  </code></pre>
  <p>Now, from here I would like to do some kind of graph (I'm thinking of a bar graph) using Matplotlib that would have years on the bottom and going up by the amount as per the table1 result.
  I am struggling to create one, even though it should technically be as easy as putting data on the x column and data on the y column.</p>
  <p>Like the code from W3 Schools: <a href="https://www.w3schools.com/python/matplotlib_bars.asp" rel="nofollow noreferrer">https://www.w3schools.com/python/matplotlib_bars.asp</a></p>
  <pre><code>x = np.array([&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;])
  y = np.array([3, 8, 1, 10])
  
  plt.bar(x,y)
  plt.show()
  </code></pre>
  <p>I wonder if my data is in the wrong format? What would be my x-axis and y-axis?</p>