Weighted smoothing of a 1D array - Python
<p>I am quite new to Python and I have an array of some parameter detections, some of the values were detected incorrectly and (like 4555555):</p>

<pre><code>array = [1, 20, 55, 33, 4555555, 1]
</code></pre>

<p>And I want to somehow smooth it. Right now I'm doing that with a weighted mean:</p>

<pre><code>def smoothify(array):
    for i in range(1, len(array) - 2):
        array[i] = 0.7 * array[i] + 0.15 * (array[i - 1] + array[i + 1])
    return array
</code></pre>

<p>But it works pretty bad, of course, we can take a weighted mean of more than 3 elements, but it results in copypasting... I tried to find some native functions for that, but I failed.</p>

<p>Could you please help me with that? </p>

<p>P.S. Sorry if it's a noob question :(</p>

<p>Thanks for your time,
Best regards, Anna</p>