title: Python slicing behavior using for loop
body: <p>I am trying to use a for loop to create a series from entries in a dataframe, however I am having difficulties getting the last element of the dataframe.</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  a = pd.DataFrame([0,1,2,3,4,5,6,7])
  a.values[-1] # returns 7
  a.values[-5:-1]# returns 3,4,5,6
  a.values[-5:]# returns 3,4,5,6,7
  
  
  b = []
  for i in range(0,len(a)):
      b.append(a.values[-(i+1):-i])
  
  
  </code></pre>
  
  <p>I would like for 7 to be included in the list b. I realize that when i=0, a.values gives an empty array, however I'm not sure how to fix this as I can't iterate i to be blank as shown above.</p>