Home Python: Create Dataframes with different names in Loop
Reply: 0

Python: Create Dataframes with different names in Loop

user694
1#
user694 Published in May 21, 2018, 3:01 am

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:

  1. tables_EN, containing the EN csv
  2. tables_FR, containing the FR csv
  3. tables_DE, containing the DE csv

Is it possible to obtain an output as described?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.32343 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO