Reputation: 615
I currently have a list of languages:
languages_list =['EN', 'DE', 'FR']
And a different CSV file for each language.
I would need to create a loop, where for each language I create a new dataframe by uploading the specific CSV file:
for language in languages_list:
tables_ + str{language} = pd.read_csv(language + ".csv", header = 0, encoding = "latin1")
The desired output should be 3x dataframe in this case:
Is it possible to obtain an output as described?
Upvotes: 1
Views: 1661
Reputation: 862406
I think better is create dictionary of DataFrames
like:
tables={x: pd.read_csv(x + ".csv", header = 0, encoding = "latin1") for x in languages_list}
print (tables['EN'])
Upvotes: 3