The pct_change() function works similar to the diff function and computes the percentage of the difference between two different values in the DataFrame. Just like in diff(), the periods parameter provides flexibility so that we can evaluate between different elements that are spaced apart by a few rows:
sales_df.pct_change()
The following is the output:
Percentage change across rows
The fill_method parameter allows NAs to be handled by methods such as padding prior to computation. The limit parameter helps set a threshold on a permissible number of NAs.