title: Is there way to use Python Pandas to subtract a specific row from another row?
body: <p>Portion of my code that's giving trouble below. I open a CSV and want to subtract the 1st row from the last row then append it to a new file. I get an error KeyError: 96 when I try it. I know the problem is the df[96]-df<a href="https://i.stack.imgur.com/acJZl.jpg" rel="nofollow noreferrer">1</a> but I'm not sure why it's wrong, I've also tried df[96,:]-df[1,:]</p>
  <p>df opens a csv that looks like a header description with numbers in each column (30 columns)</p>
  <pre><code>df = pd.read_csv('filename')
  
  dictionarylist = []
  
  newsum = df[96]-df[1] # I want to subtract row 1 (after header) from row 96 (or whatever the last row is)
  
  dictionarylist.append(newsum)
  </code></pre>
  <p>One thing though, I want the output to be in list format so I can add another value in the first value of the list. So the list output would be like listoutput = [-5, 3, 2] and then I can go listoutput[0] = current_date_variable</p>
  <p><a href="https://i.stack.imgur.com/53xqH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/53xqH.jpg" alt="csv table" /></a>
  <a href="https://i.stack.imgur.com/59mgK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/59mgK.jpg" alt="newsum original" /></a></p>