I have a dataframe with 3 columns. I would like to create multiple dataframes based on the value of column StoreCountryName. An example of the dataframe dataset can be seem below.
+----------------------+--+------------------+--+------------------+
| ReceiptCode | | ItemCategoryName | | StoreCountryName |
+----------------------+--+------------------+--+------------------+
| 0000P70322000039467 | | Wrapping | | Japan |
| 0000P70322000031468 | | Kitchen | | Germany |
| 0000P70322000031467 | | Food | | Germany |
| 0000P70322000032267 | | Kitchen | | Japan |
| 0000P70322000031467 | | Food | | Denmark |
| 0000P70322000031867 | | Food | | Denmark |
| 0000P70322000051467 | | Interior | | Germany |
| 0000P70322000087468 | | Kitchen | | Switzerland |
| 0000P70322000031469 | | Leisure | | Germany |
| 0000P70322000031439 | | Food | | Switzerland |
+----------------------+--+------------------+--+------------------+
The result I would like for each StoreCountryName value is
print(dataset_Denmark)
+----------------------+--+------------------+--+------------------+
| ReceiptCode | | ItemCategoryName | | StoreCountryName |
+----------------------+--+------------------+--+------------------+
| 0000P70322000031467 | | Food | | Denmark |
| 0000P70322000031867 | | Food | | Denmark |
+----------------------+--+------------------+--+------------------+
Also, would it be possible to automatically name the dataframe as dataset+'_Country', i.e. dataset_Denmark?
{ x : y for x, y df.groupby('StoreCountryName')}