> > The following line: array([6.95e-5]).astype('S')

> > returns: array(['6'], dtype='|S1')

> I don't know what it should do. Issue a warning, maybe?

> What are you trying to do?

At the very least a warning would not hurt. When I first started

using the numpy arrays it looked like conversion to string would

ensure that the minimum string length needed to accurately represent

the numbers in the array would be used. It wasn't until I noticed

some odd outliers in my plotted data that I realized what was going on

-- when exponential notation is used, the conversion gets truncated.

I use numpy arrays to store data from SQL queries, and this data

sometimes has mixed types (string, number, etc.). I now realize that

I was setting up the arrays wrong and should have been using

dtype=object instead. It just seems like the above might be

something that might "bite" new users of numpy unintentionally.

Orest

_______________________________________________

Numpy-discussion mailing list

[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion