[SciPy-User] structured array question? (slow learner :)

Ernest Adrogué eadrogue at gmx.net
Sun Mar 7 12:56:26 EST 2010


 6/03/10 @ 14:08 (-0700), thus spake Vincent Davis:
> 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
> strings.

Notice that you can also use Python objects instead of strings,
as there's little or no performance penalty.

In [5]: np.array([('foo', 4.5), ('bar', 5.1)], 'O, d')

This way you need not specify the length of the string in the dtype. 

Ernest




More information about the SciPy-User mailing list