@staticmethod
    def to_json(df, columns, confidence={}):
        """Transforms dataframe to properly formatted json response"""
        records = []

        display_cols = list(columns.keys())
        if not display_cols:
            display_cols = list(df.columns)

        bounds = {}
        for c in confidence:
            bounds[c] = {
                "min": df[confidence[c]["lower"]].min(),
                "max": df[confidence[c]["upper"]].max(),
                "lower": confidence[c]["lower"],
                "upper": confidence[c]["upper"]
            }

        labels = {}
        for c in display_cols:
            if columns[c] in "label":
                labels[c] = columns[c]["label"]
            else:
                labels[c] = c

        for i, row in df.iterrows():
            row_ = DataTable.format_row(row, bounds, columns)
            records.append({labels[c]: row_[c] for c in display_cols})

        return {
            "data": records,
            "columns": [{"data": labels[c]} for c in display_cols]
        }
dataset/ETHPy150Open stitchfix/pyxley/pyxley/charts/datatables/datatable.py/DataTable.to_json/swapped operands of `in`