April 2019
Intermediate to advanced
426 pages
11h 13m
English
Differencing involves the difference of time series values with a time lag. The first-order difference of the time series is given by the following formula:

We can reuse the df_log variable in the previous section as our logarithmic transformed time series, and utilize the diff() and shift() methods of NumPy modules in our differencing, with the following code:
In [ ]: df_log_diff = df_log.diff(periods=3).dropna() # Mean and standard deviation of differenced data df_diff_rolling = df_log_diff.rolling(12) df_diff_ma = df_diff_rolling.mean() df_diff_std = df_diff_rolling.std() # Plot the stationary data plt.figure(figsize=(12, ...
Read now
Unlock full access