# Rolling average in pandas using a Gaussian window

I want to estimate the rolling average of a time series B using a Gaussian window. The equation to do this would correspond to

$$\tilde{B_{s}}(t_{n}) = \frac{1}{A_{s}} \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}B(t_{m})e^{-\frac{(t_{m} -t_{n})^{2}}{2s^{2}}}$$

where $$A_{s} = \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}e^{-\frac{(t_{m} -t_{n})^{2}}{2s^{2}}}$$

I am aware that pandas has a an option for a gaussian window.

However, I am not sure if it is equivalent to the version of Gaussian averaging that I am interested in using.

So my questions are:

In

hrly = pd.Series(hourly[0][344:468])
smooth = hrly.rolling(window=5, win_type='gaussian', center=True).mean(std=0.5)

1. Is the win_type='gaussian' going to give me the desired result?
2. What is the role of std=0.5?
3. If I wanted to do this using .apply() and use a manual function, how should the function be like?

2. std means standard deviation; that's the $$\sigma$$ ou usually see in the definition of the Gaussian. Its "width". In your formula, it looks like the $$s$$, but I'm not 100% sure your $$A_s$$ actually is the same as the usual Gaussian pre-factor. Check against the usual definition of the Gaussian!
3. that I don't know, but it's really not a signal processing, but a Pandas/Python programming "craft" question -> asking (searching, first) on Stackoverflow "How do I .apply a function manually" is probably a good idea.
2. This is the $$\sigma$$ parameter in your equation.