Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to append panda columns using loop

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #append #panda #columns #loop
ADD COMMENT
Topic
Name
3+9 =