python - Parameterized pandas data frame names -


how create data frame name resolves variable? example below created dataframe pd0,pd2..pd10

for in range(0,10):     pd + "i" = pd.dataframe() 

option 1
in opinion, better track them in dictionary.

dfs = {'pd{}'.format(i): pd.dataframe() in range(10)} 

access them

dfs['pd0'] 

option 2
if insist on placing names namespace

for in range(10):     exec('pd{} = pd.dataframe();'.format(i)) 

option 3
or without exec

for in range(10):     locals()['pd{}'.format(i)] = pd.dataframe() 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

Ansible warning on jinja2 braces on when -