0

我是这个问题的新手,我的问题是多方面的。

我有一个 excel 工作簿,它有 11 张。每张表表示一个样本,所以我有 11 个数据样本。在每张表中,有 3 列,其中 B、C 表示特征 1 和 2,列 D 表示 Y。每张表中的行数不同,即 11 个样本具有不同的时间步长。

我需要将其创建为要发送到 LSTM 的格式。

我知道 LSTM 接受输入为 [samples,timesteps,features]

# Create the pd.ExcelFile() object
xls = pd.ExcelFile('DataMaster.xlsx')

# Extract the sheet names from xls
exchanges = xls.sheet_names

# Create an empty list: listings
X = []

# Import the data
for exchange in exchanges:
    listing = pd.read_excel(xls, sheet_name=exchange, na_values='n/a', usecols="B,C")
    listing = listing.to_numpy()
    X.append(listing)

X = np.array(X)
print(X.shape)

这给了我一个(11,)的形状。它将特征和时间步长作为单个数据所以我遇到的问题是将数据从多个工作表导入到字典中,并将它们转换为 LSTM 的输入。

我知道填充过程,但我现在不想填充它们。

4

0 回答 0