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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -