I am having a list pct_change
. I need to calculate std deviation on the list ignoring the zeros. I tried below code, but it is not working as expected.
import numpy as np
m = np.ma.masked_equal(pct_change, 0)
value = m.mask.std()
Input value: pct_change
0 0.00
1 0.00
2 0.00
3 18523.94
4 15501.94
5 14437.03
6 13402.43
7 18986.14
Code has to ignore 3 zero values and then calculate standard deviation.