(df, state_index, color_index, fills)
return {
            "data": records,
            "fills": fills
        }
Transforms dataframe to json response
Transforms dataframe to json response
Transforms dataframe to json response
def to_json(df, state_index, color_index, fills):
        """Transforms dataframe to json response"""
        records = {}
        for i, row in df.iterrows():

            records[row[state_index]] = {
                "fillKey": row[color_index]
            }

        return {
            "data": records,
            "fills": fills
        }
def to_json ( df , state_index , color_index , fills ) : records = { } for i , row in df . iterrows ( ) : records [ row [ state_index ] ] = { "fillKey" : row [ color_index ] } return { "data" : records , "fills" : fills }