I think this is a special case that was overlooked. It works if there are multiple positions but only one value: >>> a = arange(5) >>> insert(a,[3,3],4) array([0, 1, 2, 4, 4, 3, 4])
But not when you give one position with mutiple values: >>> insert(a,3,[7,7]) array([0, 1, 2, 7, 3, 4]) It would be great if somebody could implement this. Probably not too hard I guess, Thanks. You guys are the best, Mark On May 27, 11:26 am, "Stéfan van der Walt" <[EMAIL PROTECTED]> wrote: > Hi Mark > > 2008/5/27 mark <[EMAIL PROTECTED]>: > > >>>> a = arange(5.) > >>>> insert(a,3,[7,7]) > > array([ 0., 1., 2., 7., 3., 4.]) > > > But insert only inserts one of the 7's, while I want both values to be > > inserted. Nor does numpy throw a warning (which I think would be > > appropriate). The way that works correctly is > > >>>> insert(a,[3,3],[7,7]) > > array([ 0., 1., 2., 7., 7., 3., 4.]) > > You need to specify two insertion positions, i.e. > > np.insert(a, [3, 3], [7, 7]) > > I think we should consider a special case for your example, though. > > Regards > Stéfan > _______________________________________________ > Numpy-discussion mailing list > [EMAIL PROTECTED]://projects.scipy.org/mailman/listinfo/numpy-discussion _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion