Is there a Python method to calculate moving RMS of a signal? How to calculate the moving RMS using the discrete signal formula?
There are quite a few solutions, you can recognize that you have the square root of the rolling mean of the squared magnitude of the signal. Using pandas rolling mean this could be written as follows.
import pandas as pd;

def rolling_rms(x, N):
  return (pd.DataFrame(abs(x)**2).rolling(N).mean()) **0.5

Each entry in the result contains the RMS of N contiguous samples, where i &lt; N the result is filled with nan.
If you care more for efficiency you can do something like this
import numpy as np;
def rolling_rms(x, N):
    xc = np.cumsum(abs(x)**2);
    return np.sqrt((xc[N:] - xc[:-N]) / N)

this particular implementation skips the first valid entry, so if you want it, you can insert a zero at the beginning of x.