Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. a=numpy.array([1, 2, 3, 4, 5, 6,]);
  2. b=numpy.array([7,8,9]);
  3. c=numpy.array([10,11,12,13,14,15,16,17,18,19,20]);
  4.  
  5. ##Doesn't do what I want
  6. data=numpy.array([a, b, c],dtype=[('a','f8'),('b','f8'),('c','f8')]);
  7.  
  8. >>> data = {'a':a, 'b':b, 'c':c}
  9. >>> data['a'] is a
  10. True
  11.  
  12. >>> np.zeros(3,dtype=[('a',(int,3)),('b',(float,5))])
  13.  
  14. >>> x=np.zeros(3, dtype=[('a',object), ('b',object)])
  15. >>> x['a'][0] = [1,2,3,4]
  16. >>> x['b'][-1] = "ABCDEF"
  17. >>> print x
  18. [([1, 2, 3, 4], 0) (0, 0) (0, 'ABCD')]
  19.  
  20. blob = np.array([(a,b,c)],dtype=[('a',object),('b',object),('c',object)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement