Re: [Numpy-discussion] numpy.append and persisting original datatype

July 25, 2010
9:56 a.m.
Hello, After a little more research, I can see that as a work around is: foo = np.append(foo, np.asanyarray([1., 2., 3.], dtype=foo.dtype)) It seems that within numpy.append(), the call to ravel() (numpy/ function.base.py [line 3490]) produces an array with a dtype that best fits. In this case it is float64 (when my original array was float32). Best wishes
5380
Age (days ago)
5380
Last active (days ago)
0 comments
1 participants
participants (1)
-
Martin Galpin