nan functions convert matrix to array
Dec. 1, 2006
9:46 p.m.
The first line of the nan functions (such as nansum, nanmin, nanmax) is y = array(a) That leads to matrix in, array out. Is there some way to make it matrix in, matrix out? Here, for example, is nansum: def nansum(a, axis=None): """Sum the array over the given axis, treating NaNs as 0. """ y = array(a) if not issubclass(y.dtype.type, _nx.integer): y[isnan(a)] = 0 return y.sum(axis)
Dec. 1, 2006
10:42 p.m.
On Friday 01 December 2006 16:46, Keith Goodman wrote:
The first line of the nan functions (such as nansum, nanmin, nanmax) is
Is there some way to make it matrix in, matrix out?
Quick workaround: Overwrite these functions with your own, where 'array' or 'asarray' in the first line is replaced by 'asanyarray'.
7201
Age (days ago)
7201
Last active (days ago)
1 comments
2 participants
participants (2)
-
Keith Goodman -
Pierre GM