📜  如何使用循环附加熊猫列 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:44.431000             🧑  作者: Mango

代码示例1
import pandas as pd
import glob

f_list = glob.glob("C:\\Users\\*.xlsx")  
#list comprehension 
all_data = [pd.read_excel(f) for f in f_list]  

#same like loops solution
all_data = []            
for f in f_list:                       
    df = pd.read_excel(f)             
    all_data.append(df)
    
df = pd.concat(all_data, axis=1)