code: def to_json(df, values):
          
          records = []
          if df.empty:
              return {"data": []}
  
          sum_ = float(np.sum([df[c].iloc[0] for c in values]))
          for c in values:
              records.append({
                  "label": values[c],
                  "value": "%.2f"%np.around(df[c].iloc[0] / sum_, decimals=2)
                  })
          return {
              "data" : records
          }
docs: Format output for the json response.