title: How to shift several rows in a pandas DataFrame?
body: <p>I have the following pandas Dataframe:</p>
  
  <pre><code>import pandas as pd
  data = {'one' : pd.Series([1.], index=['a']), 'two' : pd.Series([1., 2.], index=['a', 'b']), 'three' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}
  df = pd.DataFrame(data)
  df = df[["one", "two", "three"]]
  
  
     one  two  three
  a  1.0  1.0    1.0
  b  NaN  2.0    2.0
  c  NaN  NaN    3.0
  d  NaN  NaN    4.0
  </code></pre>
  
  <p>I know how to shift elements by column upwards/downwards, e.g. </p>
  
  <pre><code>df.two = df.two.shift(-1)
  
     one  two  three
  a  1.0  2.0    1.0
  b  NaN  NaN    2.0
  c  NaN  NaN    3.0
  d  NaN  NaN    4.0
  </code></pre>
  
  <p>However, I would like to shift all elements in row <code>a</code> over two columns and all elements in row <code>b</code> over one column. The final data frame would look like this:</p>
  
  <pre><code>   one  two  three
  a  NaN  NaN    1.0
  b  NaN  NaN    2.0
  c  NaN  NaN    3.0
  d  NaN  NaN    4.0
  </code></pre>
  
  <p>How does one do this in pandas? </p>