I have a folder with a number of files. I want to import the sheet 'sheet1' as a pandas dataframe for each of them, assigned to the name of a portion of that title.
I've successfully gotten a list of filenames:
path = "/Users/path"
files = os.listdir(path)
files_xls = [f for f in files if f[-3:] == 'xls']
['A.xls', 'B.xls']
And I've successfully made a list of names I'd like as the dataframe names:
names = map(lambda each:each.strip(".xls"), files_xls)
['A', 'B']
But I'm failing at using these names to import. I can do it manually:
A = pd.read_excel(A.xls, 'sheet1')
B = pd.read_excel(B.xls, 'sheet1')
etc...
But I can't figure out how to automate this process.