在列表中追加多个数据框

时间:2019-03-03 13:40:04

标签: excel list dataframe printing append

我有一个循环,该循环读取目录中的多个excel工作表,并且要将结果存储在列表中

path =r'/Users/user/PycharmProjects/Apriori ' # use your path
allFiles = glob.glob(os.path.join(path, "*.csv"))

List_ = list()
f = open('Rules.txt', 'w')
for file_ in allFiles:
    Rules_df = Association_rules(file_)
    List_.append(Rules_df)
    f.write(tabulate(Rules_df, headers=['antecedents','consequents', 'support' ,'antecedentsupport',
                                 'consequentsupport','confidence','lift','leverage',
                                 'conviction', 'antecedentsLen']))
f.close()

当“ Rules.txt”打印结果时,列表返回空的dataFrames。我在做什么错了?

List_
[Empty DataFrame
Columns: [antecedents, consequents, antecedent support, consequent support, support, confidence, lift, leverage, conviction, antecedent_len]

0 个答案:

没有答案