Using the 1.5 × IQR fences on the whole amount column, store the list of txn_id values that fall outside the fences in result, in table order.
import pandas as pd
import numpy as np
txns = pd.DataFrame({
"txn_id": list(range(1, 25)),
"store": ["Pune"] * 8 + ["Mumbai"] * 8 + ["Delhi"] * 8,
"amount": [420, 515, 480, 610, 455, 9800, 530, 470,
2100, 2350, 1980, 2240, 2500, 2050, 150, 2300,
880, 940, 1020, 860, 990, 910, 99999, 1050],
"qty": [1, 2, 1, 2, 1, 3, 2, 1,
1, 1, 2, 1, 30, 1, 1, 2,
1, 2, 2, 1, 1, 2, 1, 2],
})Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.