
本文源码请见我的GitHub
2.9.1 生成结构化数组
1 |
import numpy as np |
1 |
np.dtype([('name','S10'),('age','i4'),('weight','f8')]) |
dtype([('name', 'S10'), ('age', '<i4'), ('weight', '<f8')])
1 |
|
dtype([('f0', 'S10'), ('f1', '<i4'), ('f2', '<f8')])
2.9.2 高级复合类型
1 |
tp = np.dtype([('id','i8'),('mat','f8',(3,3))]) |
(0, [[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]])
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]




近期评论