我相信你需要一个新的
DataFrame
:
L = [x[:-2] for x in self.dfile_keys[6:] if x.endswith('-0')]
new = self.dfile.loc[:, self.dfile.columns.str.startswith(tuple(L))]
df = pd.concat([self.dfile[['load','rps','th95','energy']], new], axis=1)
list of DataFrame
学生:
self.unique_counters = [x[:-2] for x in self.dfile_keys[6:] if x.endswith('-0')]
dfs = [self.dfile.loc[:, self.dfile.columns.str.startswith(counter)]
for counter in self.unique_counters]
df = pd.concat([self.dfile[['load','rps','th95','energy']], dfs], axis=1)