https://www.yiibai.com/numpy/numpy_data_types.html
C++/C 这样定义一个结构体类型,里面又许多不同的数据:
struct node{
int age;
string name;
bool sex;
};
Python:
numpy.dtype(object, align, copy)
解释下:
1. 使用np.dtype 来构建一个数据结构体内部的数据类型,包含字段名以及这个字段数据类型(一定要注意数据类型,
S:字符串(英文字符串),U:unicode (中文),b: bool 值, i : int 等等)
student = np.dtype([('name','S20'), ('age', 'i1'), ('marks', 'f4')])
那么相当于c中:
struct student{
char name[20];
int age;// 8位整型数
float marks // 32位浮点