[Numpy-discussion] Setting contents of buffer for array object

Matthew Brett matthew.brett@gmail....
Sun Feb 10 18:48:36 CST 2008


> > import numpy as np
> > a = np.arange(10)
> > b = np.arange(10)+1
> > a.data = b.data # raises error, but I hope you see what I mean
> >
> > ?
>
> Not really, no. Can you describe your use case in more detail?

Yes - I am just writing the new median implementation.   To allow
future optimization, I would like to have the same signature as
mean():

def median(a, axis=0, dtype=None, out=None)

(axis=0 to change to axis=None default at some point).

To do this, I need to copy the results of the median calculation in
the routine into the array object given by 'out' - when passed.

Matthew


More information about the Numpy-discussion mailing list