import numpy as np import os dirPath = "G:\深度学习/2022-2023\小论文相关\code\PHM 2012轴承挑战数据集\phm-ieee-2012-data-challenge-dataset-master\Learning_set\Bearing1_1" files = os.listdir(dirPath) data = np.zeros(5) for file in files: path = os.path.join(dirPath, file) x = np.loadtxt(path, delimiter=",", usecols=4) x = np.transpose(x) x = np.expand_dims(x, 0) if (data == 0).all(): data = x else: data = np.concatenate((data, x)) # print(data.shape) (2803,2560) print(data.shape) # np.save("./data/Bearing1_1.npy", data, allow_pickle=True)