@staticmethod
    def to_json(df, values):
        records = []
        if df.empty:
            return {"data": []}

        sum_ = 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
        }
Format output for the json response.
dataset/ETHPy150Open stitchfix/pyxley/pyxley/charts/nvd3/pie_chart.py/PieChart.to_json