Is there a Python method to calculate moving RMS of a signal? How to calculate the moving RMS using the discrete signal formula? I'm trying to calculate a moving RMS of an acceleration signal.
One of the answers in the post, shows the formula for calculating moving RMS for discrete signal.
The formula they suggest:

I have a few questions on this formula. Since $i$ would be, for most part of the summation, less than $N$(no of samples), therefore k would be negative and the negative index does not make sense to me. That's why I'm having trouble understanding this formula.
Also, is there a python method to find moving RMS of a signal like MATLAB has dsp.MovingRMS?
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.