title: Pandas: List-like indexing for .loc[...]
body: <p>I think I'm missing something very simple, but I'm trying to use list-like indexing with <code>.loc[...]</code> to select all but the last row in a dataframe.  </p>
  
  <p><strong>Setup:</strong></p>
  
  <pre><code>import pandas as pd
  
  df = pd.DataFrame({
          'a':[1,2,3,4,5],
          'b':[6,7,8,9,0]
      })
  </code></pre>
  
  <p><strong>Attempted code:</strong></p>
  
  <pre><code>df.loc[:-1, 'a'] = df.loc[:-1, 'b']
  </code></pre>
  
  <p>But <code>df.loc[:-1, 'a']</code> yields: <code>Series([], Name: a, dtype: int64)</code> and not that series up until the last row.</p>
  
  <p><strong>Desired result:</strong></p>
  
  <pre><code>   a  b
  0  6  6
  1  7  7
  2  8  8
  3  9  9
  4  5  0
  </code></pre>
  
  <p><strong>Working, but hacky code:</strong></p>
  
  <pre><code>df.loc[:df.shape[0] - 2, 'a'] = df.loc[:df.shape[0] - 1, 'b']
  </code></pre>
  
  <p>My actual code is more complex and relies on this code, so I don't want to completely reinvent the wheel to get to the desired result, I guess I was just wondering if there's a simple way to find rows similar to native python's <code>l[:-1]</code>.</p>