[SciPy-User] structured array question? (slow learner :)
Sun Mar 7 08:58:24 CST 2010
On Sat, Mar 6, 2010 at 3:08 PM, Vincent Davis <email@example.com>wrote:
> Again I am new to this but I spent 2hr on this and looked at the
> documentation an tutorials. To be fare there are not a lot of examples using
> I would suggest that there are two many ways to specify dtype. At least
> that is my impression.
> I would find a nice table that list all with the different way they are
> for example
> @ Ryan used ('xb','S5')
> @ Christopher used ('xb', '|S10')
These are both specifying strings. 'S5' is just specifying a string length
of 5 while '|S10' is specifying a string length of 10. The '|' is optional
and specifies that the system-native endianness should be used to control
the byte ordering. So these are both the exact same way.
> I tried ('xb', |S10)
There's no way this actually ran without quotes.
> there is also a10 or somthing
'a' is the same as using 'S' above.
> numpy.float64() can be used
That's for floating point types, not strings. A lot of the complexity from
strings is that, unlike numeric types, there's no minium/typical sizes to
assume for strings. This, combined with the fact that all items within a
numpy array have to have the same size, makes string handling complex.
(This implies that in memory, (1,1,'apple', 'pie') and (2,5,'boys','play')
will occupy the same amount of memory.)
Did you look at this:
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User