Python Forum

Full Version: Concatenate Specific Cell Interval With Pandas
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to concatenate specific columns and rows of multiple excel file(Like first.xlsx[B13:D13] and second.xlsx[B13:D13]). How can I improve my codes on below?

import os
import pandas as pd


path = os.getcwd()
files = os.listdir("C:\Files");

files_xls = [f for f in files if f[-3:] == 'xls' or 'xlsx']
print(files_xls)


df = pd.concat(map(pd.read_excel, glob.glob(os.path.join('',"C:\Files\*.xls"))),axis=1)

print(df)