bounds = { c: dict( zip(["q1", "q3"], df.approxQuantile(c, [0.25, 0.75], 0)) ) for c in df.columns } for c in bounds: iqr = bounds[c][\'