I have a list of csv file pathnames in a list, and I am trying to save them as dataframes. How can I do it?
import pandas as pd
import os
import glob
# use glob to get all the csv files
# in the folder
path = "/Users/azmath/Library/CloudStorage/OneDrive-Personal/Projects/LESA/2022 HY/All"
csv_files = glob.glob(os.path.join(path, "*.xlsx"))
# loop over the list of csv files
for f in csv_files:
# read the csv file
df = pd.read_excel(f)
display(df)
print()
The issue is that it only prints. but I dont know how to save. I would like to save all the data frames as variables, preferably as their file names.