Numpy arrays must have one dtype if it is not structured. Since you have multiple lines in an array, they should all be lines.
If you want to have a complex dtype , you can do this:
import numpy as np a = np.array([('Bob','4.56'), ('Sam','5.22'),('Amy', '1.22')], dtype = [('name','S3'),('val',float)])
Note that a now a 1d structured array , where each element is a dtype type dtype .
You can access the values ββusing their field name:
In [21]: a = np.array([('Bob','4.56'), ('Sam','5.22'),('Amy', '1.22')], ...: dtype = [('name','S3'),('val',float)]) In [22]: a Out[22]: array([('Bob', 4.56), ('Sam', 5.22), ('Amy', 1.22)], dtype=[('name', 'S3'), ('val', '<f8')]) In [23]: a['val'] Out[23]: array([ 4.56, 5.22, 1.22]) In [24]: a['name'] Out[24]: array(['Bob', 'Sam', 'Amy'], dtype='|S3')