[Numpy-discussion] np.zeros(2, 'S') returns empty strings.

Charles R Harris charlesr.harris@gmail....
Sat Jan 14 16:12:15 CST 2012


This sort of makes sense, but is it the 'correct' behavior?

In [20]: zeros(2, 'S')
Out[20]:
array(['', ''],
      dtype='|S1')

It might be more consistent to return '0' instead, as in

In [3]: zeros(2, int).astype('S')
Out[3]:
array(['0', '0'],
      dtype='|S24')

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120114/35805be6/attachment.html 


More information about the NumPy-Discussion mailing list