title: Pandas: Idiomatic method for indexing an element that is a certain position away from a known label?
body: <p>I'm looking for a simple idiomatic way to index into an element that I don't know its label or position) that is a certain position away from a known element (an element that I know the label of).</p>
  
  <p>I read most of the Pandas docs at <a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html" rel="nofollow noreferrer">Selecting and Indexing</a>. Still couldn't find the answer.</p>
  
  <p>I was hoping to be able to do something like:</p>
  
  <p><code>df.loc['some known label' + 3]</code>
  To get the row that is 3 elements below some known label.</p>
  
  <p>Or perhaps use it with slicing:
  <code>df.loc['some known label' - 3 : 'some other know label' + 5]</code></p>
  
  <p>so from the data frame below:</p>
  
  <pre><code>In [44]: df1 = pd.DataFrame(np.random.randn(6, 4), index=list('abcdef'), columns=list('ABCD')) 
  
  In [45]: df1
  Out[45]: 
            A         B         C         D
  a  0.132003 -0.827317 -0.076467 -1.187678
  b  1.130127 -1.436737 -1.413681  1.607920
  c  1.024180  0.569605  0.875906 -2.211372
  d  0.974466 -2.006747 -0.410001 -0.078638
  e  0.545952 -1.219217 -1.226825  0.769804
  f -1.281247 -0.727707 -0.121306 -0.097883
  </code></pre>
  
  <p>I would like to do something like  <code>df.loc['c' + 2]</code></p>
  
  <p>and get:</p>
  
  <pre><code>          A         B         C         D
  e  0.545952 -1.219217 -1.226825  0.769804
  </code></pre>
  
  <p>Thanks for your time.</p>