title: How to return values to new columns based off indexed rows
body: <p>The question title may not accurately reflect the question as it's quite difficult to summarise. It's much easier to display. I am trying to create new columns based of the value from a column in a df. These values are at intermittent index points. They will always be labelled or associated with the other columns.</p>
  
  <p>Input:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  k = 5
  N = 10
  
  df = pd.DataFrame({ 'Frame' : range(1, N + 1 ,1),
      'A_X' : np.random.randint(k, k + 100 , size=N),
      'A_Y' : np.random.randint(k, k + 100 , size=N),
      'B_X' : np.random.randint(k, k + 100 , size=N),
      'B_Y' : np.random.randint(k, k + 100 , size=N),   
      'C_X' : np.random.randint(k, k + 100 , size=N),
      'C_Y' : np.random.randint(k, k + 100 , size=N),
      'D_X' : np.random.randint(k, k + 100 , size=N),
      'D_Y' : np.random.randint(k, k + 100 , size=N),
      'E_X' : np.random.randint(k, k + 100 , size=N),
      'E_Y' : np.random.randint(k, k + 100 , size=N),
      'Events' : ['nan','A','nan','C','D','A','nan','nan','C','C']})
  </code></pre>
  
  <p>This results in:</p>
  
  <pre><code>   A_X  A_Y  B_X  B_Y  C_X  C_Y  D_X  D_Y  E_X  E_Y Events  Frame
  0   95   61   76   47   22   38   54   19   64   13    nan      1
  1   82   87   87   24   59   31   55   16  101   78      A      2
  2   10   25   66   28   70   78   75   19   23   90    nan      3
  3   55   64   15   11   46   87   65   51   10   92      C      4
  4   53  103   10   65  103   86   24   49   33   34      D      5
  5   12   44   89   14   28   26   17   55   64   76      A      6
  6   69   24   73   12   84   71   71   76    5   18    nan      7
  7   40   35   73   40   78   31   51   33   77   98    nan      8
  8   65   69   83   33   20   90   64   12   19   84      C      9
  9   24   70   18   96   65   67   73   42   49   78      C     10
  </code></pre>
  
  <p>The first 10 columns are XY data. I want to select appropriate XY value's to create the new columns. They are selected through the 'Events' column. The values will always correspond with the other columns. For e.g. the 2nd row of Events is 'A' so I want to get the X and Y values from Column A (A_X, A_Y) at the same index point. The next value in Events is C, so I want to the (C_X, C_Y) at row four ect.</p>
  
  <p>So the output would:</p>
  
  <pre><code>   A_X  A_Y  B_X  B_Y  C_X  C_Y  D_X  D_Y  E_X  E_Y Events  Frame   X    Y 
  0   95   61   76   47   22   38   54   19   64   13    nan      1  nan  nan 
  1   82   87   87   24   59   31   55   16  101   78      A      2  82   87
  2   10   25   66   28   70   78   75   19   23   90    nan      3  nan  nan
  3   55   64   15   11   46   87   65   51   10   92      C      4  46   87
  4   53  103   10   65  103   86   24   49   33   34      D      5  24   49
  5   12   44   89   14   28   26   17   55   64   76      A      6  12   44
  6   69   24   73   12   84   71   71   76    5   18    nan      7  nan  nan
  7   40   35   73   40   78   31   51   33   77   98    nan      8  nan  nan
  8   65   69   83   33   20   90   64   12   19   84      C      9  20   90
  9   24   70   18   96   65   67   73   42   49   78      C     10  65   67
  </code></pre>
  
  <p>I have tried to write something like this:</p>
  
  <pre><code>df['X'] = np.where(df['Events'] == ['A'])
  df['Y'] = np.where(df['Events'] == ['A'])
  </code></pre>
  
  <p>Then repeat for each column letter but this won't work as they labels are different. I though about merging the X's and Y's together and labelling them ['A','B','C','D','E']. </p>
  
  <p>But I'm still missing the next step. I'm not returning values from the df.</p>