I've read through the documentation but cannot work out how to create a structured array of strings and integers with numpy. A shortened version of my problem is below:
foo = [['asd', 1, 2],['bgf',2,3]]
bar = np.array(foo, dtype=['S10', 'i4','i4'])
I would then like to have bar[:,0] as an array of strings and bar[:,1]and bar[:,2] as arrays of integers.
Unfortunately this gives a TypeError: data type not understood. I've tried many other ways to get it to work but cannot find anything intuitive.
Currently I am just doing bar = np.array(foo) and then casting to integer whenever I call a value from the 2nd or 3rd column, which is far from ideal.
How can I create the structure array bar that I would like from the list of lists foo?