Smoothing and transforming the observations
Smoothing data removes some of the noise from the data and makes the chart appear smooth (hence the name).
Should you do it? For presentation purposes, sure! For modeling purposes, not necessarily—check this argument by William Briggs at http://wmbriggs.com/post/195/.
To execute this recipe, you will need
Matplotlib. No other prerequisites are required.
How to do it…
In this recipe, we will see how to calculate the moving averages and transform the data using a logarithmic function (the
ma_transform12 = pd.rolling_mean(riverFlows, window=12) ma_transformExp = pd.ewma(riverFlows, span=3) log_transfrom = riverFlows.apply(np.log)
How it works…