title: How to filter on year and quarter in pandas
body: <p>I have a DataFrame with a column of type datetime64[ns]. I want to filter on both year and quarter. Any suggestions on how to do this?</p>
  
  <p>I have tried this cumbersome solution</p>
  
  <pre><code>data = data[(pd.Series(pd.DatetimeIndex(data['MatCalID']).year).isin([2018]) &amp; pd.Series(pd.DatetimeIndex(data['MatCalID']).quarter).isin([2,3]))]
  </code></pre>
  
  <p>Why this complicated solution?:</p>
  
  <ul>
  <li>It is necessary to use pd.DatetimeIndex in order to access 'year' and 'quarter'</li>
  <li>It is necessary to use pd.Series to use 'isin'</li>
  </ul>
  
  <p>Unfortunately I get 'Unalignable boolean Series key provided' as an error.</p>
  
  <p>Does someone know how to do this?</p>