title: Create a line chart with datetime on x-axis and number of records on y-axis
body: <p>I am trying to create a line chart with only the month-year part from the datetime data on the x-axis and the number of records for each month on the y.</p>
  
  <p>So far, I have copied the two columns that I need from the original dataframe into a new one and changed the format of the datetime column:</p>
  
  <pre><code>line_chart =frame[['index', 'Start Time and Date']].copy()
  line_chart['Start Time and Date']=line_chart['Start Time and Date'].dt.to_period('M')
  </code></pre>
  
  <p>Next, I tried to use <code>plotly</code>to create the chart:</p>
  
  <pre><code>import plotly.express as px
  fig = px.line(line_chart, x='Start Time and Date', y='index')
  fig.show()
  </code></pre>
  
  <p>But I get this error: <code>Object of type Period is not JSON serializable</code></p>
  
  <p>I also tried plotting with <code>matplotlib</code>:</p>
  
  <pre><code>x=line_chart['Start Time and Date']
  y=line_chart['index']
  plt.plot(x,y)
  plt.gcf().autofmt_xdate()
  
  plt.show()
  </code></pre>
  
  <p>But again error: `view limit minimum 0.0 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units</p>
  
  <p>Here are some screenshots of the data:<a href="https://i.stack.imgur.com/blFa9.png" rel="nofollow noreferrer">Frame</a> <a href="https://i.stack.imgur.com/vjZym.png" rel="nofollow noreferrer">Frame1</a></p>
  
  <p>I would really appreciate some help! Thank you!</p>