def moving_average(a: np.ndarray, n: int):
    'Moving average over one-dimensional array.\n\n    Parameters\n    ----------\n    a\n        One-dimensional array.\n    n\n        Number of entries to average over. n=2 means averaging over the currrent\n        the previous entry.\n\n    Returns\n    -------\n    An array view storing the moving average.\n    '
    ret = np.cumsum(a, dtype=float)
    ret[n:] = (ret[n:] - ret[:(- n)])
    return (ret[(n - 1):] / n)
Moving average over one-dimensional array.

Parameters
----------
a
    One-dimensional array.
n
    Number of entries to average over. n=2 means averaging over the currrent
    the previous entry.

Returns
-------
An array view storing the moving average.
def moving_average(a: np.ndarray, n: int):
    'Moving average over one-dimensional array.\n\n    Parameters\n    ----------\n    a\n        One-dimensional array.\n    n\n        Number of entries to average over. n=2 means averaging over the currrent\n        the previous entry.\n\n    Returns\n    -------\n    An array view storing the moving average.\n    '
    ret = np.cumsum(a, dtype=float)
    ret[n:] = (ret[n:] - ret[:(- n)])
    return (ret[(n - 1):] / n)