[Numpy-discussion] append number to vector
Henry Harpending
harpend at xmission.com
Tue Sep 25 15:20:04 EDT 2001
I often find myself wanting to append a number to a vector. After fumbling
experimentation I use
def comma(ar,inint):
"comma(array,integer) returns array with integer appended"
t=array([inint,])
return(concatenate((ar,t),1))
which is used like the comma in apl, i.e. ar <- ar, inint.
This seems klutzy to me. Is there a simpler way to do it? If ar were a
list, ar.append(inint) works, but no such luck after ar has become an array.
Thanks, Henry Harpending, University of Utah
More information about the NumPy-Discussion
mailing list