I have collection of excel files containing similar datasets. I want it to be read by different Pandas dataframes.
import glob
import pandas as pd
path=r"C:users/me/desktop/ExcelData"
files=glob.glob('*.xls')
for f in files:
df[f]=pd.read_excel(f)
import glob
import pandas as pd
import os
path=r"C:\\users\\me\\desktop\\ExcelData\\"
csv_files = glob.glob(os.path.join(path, "*.xls"))
dfl=[]
for f in csv_files:
x= pd.read_excel(f)
dfl.append(x)
import pandas as pd
import os
import glob
path = r"C:users/me/desktop/ExcelData"
files = glob.glob(path + "\*.xls")
finalexcelsheet = pd.DataFrame()
for file in files:
df = pd.concat(pd.read_excel(file, sheet_name = None), ignore_index=True,
sort=False)
finalexcelsheet = finalexcelsheet.append(df, ignore_index = True)
print(finalexcelsheet)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.