How to name dataframes with a for loop?
问题 I want to read several files json files and write them to a dataframe with a for-loop. review_categories = ["beauty", "pet"] for i in review_categories: filename = "D:\\Library\\reviews_{}.json".format(i) output = pd.read_json(path_or_buf=filename, lines=True) return output The problem is I want each review category to have its own variable, like a dataframe called "beauty_reviews", and another called "pet_reviews", containing the data read from reviews_beauty.json and reviews_pet.json