我通常会像这样创建 numpy dtypes:
C = np.dtype([('a',int),('b',float)])
但是在我的代码中,我还使用了这些字段a并b在其他地方单独使用:
A = np.dtype([('a',int)])
B = np.dtype([('b',float)])
为了可维护性,我想C从类型中派生出来A,并且B以某种方式是这样的:
C = np.dtype([A,B]) # this gives a TypeError
numpy 有没有办法通过组合其他 dtypes 来创建复杂的 dtypes?