import numpy as np
import pandas as pd
label = np.array(pd.read_csv(r'E:\dataset\未处理数据集\Semeion\label.csv',header=None))
L = []
n = label.shape[0]
m = label.shape[1]
for i in range(n):
for j in range(m):
if label[i][j] == 1:
L.append(int(j))
break
L = np.array(L)
print(L.shape)
L = np.vstack(L)
print(L.shape)
# np.savetxt(r"E:\dataset\未处理数据集\Semeion\L.csv",L,delimiter=',')
L = pd.DataFrame(L)
L.to_csv(r"E:\dataset\未处理数据集\Semeion\L.csv",header=None,index=None)