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
-
Maybe use a dictionary so you can save the objects by unique namesChris Doyle– Chris Doyle2020-04-05 11:55:07 +00:00Commented Apr 5, 2020 at 11:55
-
1As this answer 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– DarrylG2020-04-05 11:55:48 +00:00Commented Apr 5, 2020 at 11:55
Add a comment
|