我有各种数量的输入.xlsx文档,其中包含12张(所有工作表在每个.xlsx文档中都具有相同的名称)。我需要将这些文件合并到一个.xlsx文档中,同时保留原始图纸的名称,但是每张图纸的所有文档中的数据都附加到原始图纸上。
例如,请参阅我的原始输出:
所需的输出:
这是我目前的代码:
M = matrix[3,3280]
C = []
MM = []
for col in range(len(M)):
for line in range (0,2): #0-2 for the three lines
class[col] = M[line]
# this should be a list (or can be a vector)
# with the results of the three lines for a specific column
C = class.append([class])
for line in range (len(C)):
# I try to find the common value between the three lines ans return it.
maxi = max(classes.values(), key=lambda x:classes.values().count(x))
print (maxi)
# at the end of all columns I´d expected to have a vector (or a list)
# with the most common values for each column comparing the three lines).
MM = maxis.append([maxi])
该功能正在创建文件,但每次都会覆盖工作表内容而不是附加。我不确定我错过了什么。