title: How to compare values in a column by date in pandas?
body: <p>I have the following sample DataFrame:</p>
  
  <pre><code> Item Num       Price Type       Sales Date    
   456                    4           2017-12                 
   456                    1           2018-01                 
   340                    1           2017-12                 
   340                    1           2018-01                 
   500                    2           2017-12                 
   500                    1           2018-01 
  </code></pre>
  
  <p>I want to check if for each item number that is price type 1 in january, if the price type was different in december, and flag that row. So I want my output to be this: </p>
  
  <pre><code> Item_Num       Price Type       Sales Date    Flag
   456                    4           2017-12    price type change
   500                    2           2017-12    price type change
  </code></pre>
  
  <p>I'm thinking of something like this: </p>
  
  <pre><code> for num in df.Item_Num:
       print(desired rows)
  </code></pre>