我一直在访问一个pandas数据框,并且一直出现错误。
cases_expand = []
for case in cases_II:
output = case[-1][0]
month = case[-1][1]
features = [v[0] for v in case[0:-1]] + [month] + [output]
cases_expand.append(features)
feat = ["h_", "r_", "in_Umiray_", "in_Angat_", "out_NIA_", "out_MWSS_"]
cases_df2 = pd.DataFrame(cases_expand)
col_names = []
for f in feat:
if f != "out_NIA_" and f != "out_MWSS_":
for i in range(batch_size):
col_names.append(f+str(i+1))
else:
for i in range(look_back + batch_size):
col_names.append(f+str(i+1))
col_names += ["month", "output"]
#print (col_names)
cases_df2.columns = col_names
print (col_names)
错误是:
长度不匹配:预期轴有218个元素。新值有230个元素。