From: Bill B. <wb...@gm...> - 2006-08-26 12:13:17
|
On 8/26/06, Travis Oliphant <oli...@ie...> wrote: > > > I've come up with adding the functions (not methods at this point) > > deletefrom > insertinto "delete" and "insert" really would be better. The current "insert" function seems inaptly named. What it does sounds more like "overlay" or "set_masked". ... or the existing "putmask" which I see does a similar thing. Actually there seems to be a little doc-bug there or something. numpy.insert claims it differs from putmask in that it only accepts a vector of values with same number of vals as the # of non-zero entries in the mask, but a quick test revals it's quite happy with a different number and cycles through them. In [31]: a = numpy.zeros((3,3)) In [32]: numpy.insert(a, [[0,1,0],[1,0,0],[1,0,0]], [4,5]) In [33]: a Out[33]: array([[ 0., 4., 0.], [ 5., 0., 0.], [ 4., 0., 0.]]) Anyway, in the end nothing has really been inserted, existing entries have just been replaced. So "insert" seems like a much better name for a function that actually puts in a new row or column. --bb |