title: Extract data from index in new column in Dataframe
body: <p>How do I extract data based on index values in different columns?</p>
  
  <p>So far I was able to extract data based on index number in the same column (block of 5).</p>
  
  <p><strong>The Dataframe looks like this:</strong></p>
  
  <pre><code>3017     39517.3886
  3018     39517.4211
  3019     39517.4683
  3020     39517.5005
  3021     39517.5486
  5652     39628.1622
  5653     39628.2104
  5654     39628.2424
  5655     39628.2897
  5656     39628.3229
  5677     39629.2020
  5678     39629.2342
  5679     39629.2825
  5680     39629.3304
  5681     39629.3628
  </code></pre>
  
  <p>Where the data extracted in col are +/- 2 rows around the index value</p>
  
  <p>I would like to have something that looks more like this:</p>
  
  <pre><code>  3017-3021   5652-5656   5677-5681
  1 39517.3886  39628.1622  39629.2020
  2 39517.4211  39628.2104  39629.2342
  3 39517.4683  39628.2424  39629.2825
  4 39517.5005  39628.2897  39629.3304
  5 39517.5486  39628.3229  39629.3628
  </code></pre>
  
  <p>and so on depending on the number of data that I want to extract.</p>
  
  <p>The code I'm using to extract data based on index is:</p>
  
  <pre><code>## find index based on the first 0 of a 000 - 111 list
  a = stim_epoc[1:]
  ss = [(num+1) for num,i in enumerate(zip(stim_epoc,a)) if i == (0,1)]
  
  ## extract data from a df (GCamp_ps) based on the previous index 'ss'
  fin = [i for x in ss for i in range(x-2, x + 2 + 1) if i in range(len(GCaMP_ps))]
  df = time_fip.loc[np.unique(fin)]
  print(df)
  </code></pre>