October 2019
Beginner to intermediate
674 pages
16h 43m
English
The diff() function computes the difference between subsequent rows in the same column or subsequent columns in the same row. diff() can be evaluated along a row or column by setting the axis parameter, which is set to 0 by default. Therefore, computation takes place by row:
sales_df.diff()
The following is the output:

The diff method can be applied as shown here:
sales_df.diff(axis = 1)
The following is the output:

The periods() parameter can be used to find the ...
Read now
Unlock full access