Is there a way to avoid using specific values when applying sum and mean in numpy?
I'd like to avoid, for instance, the -999 value when calculating the result.
In [14]: c = np.matrix([[4., 2.],[4., 1.]])
In [15]: d = np.matrix([[3., 2.],[4., -999.]])
In [16]: np.sum([c, d], axis=0)
Out[16]:
array([[ 7., 4.],
[ 8., -998.]])
In [17]: np.mean([c, d], axis=0)
Out[17]:
array([[ 3.5, 2. ],
[ 4. , -499. ]])
[1,1]
corner, inplace of the large negative?1
,masked
,nan
, something else? – Huai