Subtract consecutive columns in a Pandas or Pyspark Dataframe
<p>I would like to perform the following operation in a pandas or pyspark dataframe but i still havent found a solution.</p>

<p>I want to subtract the values from consecutive columns in a dataframe.</p>

<p>The operation I am describing can be seen in the image below.</p>

<p><a href="https://i.stack.imgur.com/ZQgOH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZQgOH.jpg" alt="Input and Output Dataframe"></a></p>

<p>Bear in mind that the output dataframe wont have any values on first column as the first column in the input table cannot be subtracted by its previous one as it doesn't exist.</p>