import numpy as npimport matplotlib.pyplot as pltimport pandas as pdimport scipyimport seaborn as snssns.set(style="ticks", font_scale=1.5) # white graphs, with large and legible lettersfrom matplotlib.dates import DateFormatterimport matplotlib.dates as mdates# %matplotlib widget
We can use scipy.signal.savgol_filter to apply a LOESS filter. By choosing the argument deriv=1, we tell it to return the first derivative of the smoothed signal.