I want to read multiple files into separate dataframe objects: i.e., read 'train.csv' into an object called train and the same for 'test.csv'.
The advice I've found so far (e.g., here tend to read the different files into a dictionary or list. From there, I suppose I could generate e.g., train = dict[0] but is there a way to do it directly?
For now, I ran the following but would get an error:
files = ['train.csv', 'test.csv']
names = [train, test]
for file, name in zip(files, names):
name = pd.read_csv(file)
Output/Error message:
NameError: name 'train' is not defined