title: Can you extract both year AND month from date in Pandas
body: <p>I have a dataframe with a date column (type datetime). I can easily extract the year or the month to perform groupings, but I can't find a way to extract both year and month at the same time from a date. I need to analyze performance of a product over a 1 year period and make a graph with how it performed each month. Naturally I can't just group by month because it will add the same months for 2 different years, and grouping by year doesn't produce my desired results because I need to look at performance monthly.</p>
  
  <p>I've been looking at several solutions, but none of them have worked so far.</p>
  
  <p>So basically, my current dates look like this</p>
  
  <pre><code>2018-07-20
  2018-08-20
  2018-08-21
  2018-10-11
  2019-07-20
  2019-08-21
  </code></pre>
  
  <p>And I'd just like to have <code>2018-07, 2018-08, 2018-10</code>, and so on.</p>