appended_data = []
for infile in glob.glob("*.xlsx"):
data = pandas.read_excel(infile)
# store DataFrame in list
appended_data.append(data)
# see pd.concat documentation for more info
appended_data = pd.concat(appended_data)
# write DataFrame to an excel sheet
appended_data.to_excel('appended.xlsx')
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)
Code Example |
---|
:: |
Python :: python get local ipv4 |
:: |
Python :: get random number positive or negative python |
:: |
Python :: python print n numbers |
:: is tuple immutable in python |
:: split list in pd dataframe into rows |
Python :: |
Python :: csv len python |
Python :: dot operator in python |
:: countplot for different classes in a column |
Python :: settings.debug django |
:: |
:: python enum advanced |
:: |
Python :: django queryset count |
:: |
:: |
:: sphere volume formula |
Python :: to str python |
:: arg parse array argument |
:: static files not loading 404 error django |
Python :: |
:: |
:: pandas order dataframe by index of other dataframe |
Python :: |
Python :: set points size in geopandas plot |
Python :: ram clear in python |
Python :: is python object oriented language |