I have multiple xlsx files with data in it that i want to import to separate dataframes in Python.
Currently, i want to import a spreadsheet from 2014 september and 2014 october. The spreadsheets are in different folders for each year and the file names are as follows in the month_list variable. The desired dataframe names are "2014_09_sept_df" and "2014_10_okt_df"
month_list = ['09_sept', '10_okt']
df_string_list=[]
k = 0
for i in range(2014,2015):
dirstring = 'C:/Users/folder/' + str(i)
os.chdir(dirstring)
for j in month_list:
filestring = dirstring + '/' + j + '.xlsx'
my_file = Path(filestring)
if my_file.exists():
df_string_list.append(str(i) + '_' + j + '_df')
df_string_list[k] = pd.read_excel(filestring)
k+=1
My problem is that I've created the df_string_list list for holding the dataframe names, and when I want to name the dataframes with that item from the list, the dataframe gets put into the list with this command, instead of creating a dataframe:
df_string_list[k] = pd.read_excel(filestring)
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)