title: Counting changes of value in each column in a data frame in pandas
body: <p>Is there any neat way to count the number of changes of value in each column in a data frame in pandas?</p>
  
  <p>I don't want to have to loop myself over each column, e.g.:</p>
  
  <pre><code>import pandas as pd
  
  frame = pd.DataFrame({
      'time':[1234567000,1234567005,1234567009],
      'X1':[96.32,96.01,96.05],
      'X2':[23.88,23.96,23.96]
  },columns=['time','X1','X2']) 
  
  print(frame)
  
  changes = []
  for column_name in frame.columns.values:
      print('column_name: {0}'.format(column_name))
      changes.append(sum(frame[column_name]!=frame[column_name].shift(1)))
  
  print('changes: {0}'.format(changes))
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>         time     X1     X2
  0  1234567000  96.32  23.88
  1  1234567005  96.01  23.96
  2  1234567009  96.05  23.96
  column_name: time
  column_name: X1
  column_name: X2
  changes: [3, 3, 2]
  </code></pre>