Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In [4]: ll = [['one','two',1,1.23],['four','five',4,34.3],['six','seven',4,34.3]]
- In [5]: np.array(ll)
- Out[5]:
- array([['one', 'two', '1', '1.23'],
- ['four', 'five', '4', '34.3'],
- ['six', 'seven', '4', '34.3']],
- dtype='|S5')
- In [8]: np.array([tuple(x) for x in ll],dtype='S5,S5,i,f')
- Out[8]:
- array([('one', 'two', 1, 1.2300000190734863),
- ('four', 'five', 4, 34.29999923706055),
- ('six', 'seven', 4, 34.29999923706055)],
- dtype=[('f0', 'S5'), ('f1', 'S5'), ('f2', '<i4'), ('f3', '<f4')])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement