title: How to mask a data frame by the month?
body: <p>I have a dataframe <code>df1</code> with a column <code>dates</code> which includes dates. I want to plot the dataframe for just a certain month. The column <code>dates</code> look like:</p>
  
  <pre><code>   Unnamed: 0  Unnamed: 0.1      dates      DPD  weekday
  0             0          1612 2007-06-01  23575.0        4
  1             3          1615 2007-06-04  28484.0        0
  2             4          1616 2007-06-05  29544.0        1
  3             5          1617 2007-06-06  29129.0        2
  4             6          1618 2007-06-07  27836.0        3
  5             7          1619 2007-06-08  23434.0        4
  6            10          1622 2007-06-11  28893.0        0
  7            11          1623 2007-06-12  28698.0        1
  8            12          1624 2007-06-13  27959.0        2
  9            13          1625 2007-06-14  28534.0        3
  10           14          1626 2007-06-15  23974.0        4
  
  ..          ...           ...        ...      ...      ...
  
  513         721          2351 2009-06-09  54658.0        1
  514         722          2352 2009-06-10  51406.0        2
  515         723          2353 2009-06-11  48255.0        3
  516         724          2354 2009-06-12  40874.0        4
  517         727          2357 2009-06-15  77085.0        0
  518         728          2358 2009-06-16  77989.0        1
  519         729          2359 2009-06-17  75209.0        2
  520         730          2360 2009-06-18  72298.0        3
  521         731          2361 2009-06-19  60037.0        4
  522         734          2364 2009-06-22  69348.0        0
  523         735          2365 2009-06-23  74086.0        1
  524         736          2366 2009-06-24  69187.0        2
  525         737          2367 2009-06-25  68912.0        3
  526         738          2368 2009-06-26  57848.0        4
  527         741          2371 2009-06-29  72718.0        0
  528         742          2372 2009-06-30  72306.0        1
  </code></pre>
  
  <p>And I just want to have June 2007 for example.</p>
  
  <pre><code>df1 = pd.read_csv('DPD.csv')
  df1['dates'] = pd.to_datetime(df1['dates'])
  df1['month'] = pd.PeriodIndex(df1.dates, freq='M')
  nov_mask=df1['month'] == 2007-06
  
  plot_data= df1[nov_mask].pivot(index='dates', values='DPD')
  plot_data.plot()
  plt.show()
  </code></pre>
  
  <p>I don't know what's wrong with my code.The error shows that there is something wrong with <code>2007-06</code> when i defining <code>nov_mask</code>, i think the data type is wrong but I tried a lot and nothing works..</p>