Pandas DataFrame group by and save columns as json strings
I have a pandas dataframe with following schema: import pandas as pd # Create a list of data data = [['market1', 2023, 100, 200], ['market2', 2022, 300, 400], ['market1', 2021, 500, 600], ['market2', 2020, 700, 800]] # Create a DataFrame…