我有几个numpy数组:
X = np.array([0,0,0,0,1,1,1,1])
Y = np.array([0,0,1,1,0,0,1,1])
Z = np.array([0,1,0,1,0,1,0,1])
我如何使用它们来生成这个:
array(['0_0_0',
'0_0_1',
'0_1_0',
'0,1,1',
...
], dtype='|S1')
答案 0 :(得分:0)
np.array(["_".join(row.astype('|S1')) for row in np.concatenate([[X], [Y], [Z]]).T])