Instead of deleting long deliveries, cap them (winsorising): values below the 5th percentile become the 5th percentile, values above the 95th become the 95th.
Store the capped minutes column, rounded to 2 decimals, in result.
import pandas as pd
deliveries = pd.DataFrame({
"order_id": list(range(501, 521)),
"zone": ["North", "South"] * 10,
"minutes": [28, 31, 25, 35, 30, 27, 33, 29, 26, 140, 32, 30, 24, 38, 29, 31, 95, 28, 27, 34],
})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.