title: Sort df by date column by month
body: <p>I have a df that has dates in the following format: yyyy-mm-dd</p>
  <p>I imported the data and used parse-dates to read it in as a datetime object:</p>
  <pre><code>df1 = pd.read_csv(file1, encoding=&quot;utf-8&quot;, sep=',', parse_dates=['Date'])
  </code></pre>
  <p>I want to find the max and min temperature and plot them.</p>
  <p>I am close.</p>
  <p>I am getting the basic plotting (just the max and min lines for now) to work as follows:</p>
  <pre><code>df1[&quot;str_dates&quot;] = df1[&quot;Date&quot;].astype({'Date': 'str'})
  str_dates_temp = df1.groupby(&quot;Date&quot;)[&quot;str_dates&quot;].unique().to_list()
  str_dates = [''.join(x) for x in str_dates_temp]
  df1 = df1.sort_values(by=&quot;Date&quot;, ascending=True)
  print(df1.head(), '\n')
  print(df1.tail(), '\n')
  grouped_max_list = df1.groupby(&quot;Date&quot;)[&quot;Data_Value&quot;].max().to_list()
  grouped_min_list = df1.groupby(&quot;Date&quot;)[&quot;Data_Value&quot;].min().to_list()
  
  fig, axe = plt.subplots(figsize=(16, 8), facecolor='1.0')
  axe.set_facecolor(&quot;1.0&quot;)
  plt.plot(str_dates, grouped_max_list, color='blue')
  plt.plot(str_dates, grouped_min_list, color='salmon')
  plt.show()
  </code></pre>
  <p>The issue is the df is sorted by date.  This means the data is displayed, left to right, by year then month then day.</p>
  <p>So I get Jan 2005, Feb 2005, March 2005 ... Dec 2005, Jan 2006, Feb 2006, Mar 2006 ... Dec 2006, and so on.</p>
  <p>I want all of the months grouped for plotting purposes.</p>
  <p>So I want the df sorted as follows:
  Jan 2005, Jan 2006, Jan 2007, ... Jan 2014, Feb 2005, Feb 2006, Feb 2007, ... Feb 2014, and so on.</p>
  <p>With my date sorting, my plot looks like this:
  <a href="https://i.stack.imgur.com/NLF5q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NLF5q.png" alt="enter image description here" /></a></p>
  <p>If the data were grouped by month, it would\should look like this:</p>
  <p><a href="https://i.stack.imgur.com/L01hi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L01hi.png" alt="enter image description here" /></a></p>
  <p>I am not sure how to adjust my sort to achieve the desired result.</p>
  <p>All I want is assistance with the sorting.  Nothing else.</p>