Suppose I have something stored in variable x and now i want to import some datasets and assign name- A_x to the first data, B_x to the second dataset and so on.. Say x = customer So I want datasets to be saved as A_customer, B_customer and so on. How can I do this in python 3.0
Asked
Active
Viewed 97 times
0
-
Maybe use a dictionary so you can save the objects by unique names – Chris Doyle Apr 05 '20 at 11:55
-
1As [this answer](https://stackoverflow.com/questions/40973687/create-new-dataframe-in-pandas-with-dynamic-names-also-add-new-column) mentions "Creating variables with dynamic names is typically a bad practice. I think the best solution for your problem is to store your dataframes into a dictionary and dynamically generate the name of the key to access each dataframe." – DarrylG Apr 05 '20 at 11:55