I have folder which includes many csv files namely a_1, a_2, b_1, b_2, b_1, b_2....
I want to import each csv file as their names. For example
a_1 = pd.read_csv("a_1.csv")
a_2 = pd.read_csv("a_2.csv")
In order to do that:
path = r"C:\Users\Desktop\sync\work\all_csvs"
csv_files = glob.glob(path + "/*.csv")
colname=['time', 'var_1', 'var_2', 'var_3', 'var_4', 'var_5']
os.path.basename(csv_files[0]).split(".")[0] = pd.read_csv(csv_files[0], names=colname ,header=None)
But it doesn't work. Is there any way to make the system dynamic? I will use it in the for loop.
Thanks in advance