In a time series, compare each day with the days around it. Work out a centred rolling median over 5 days of orders (allow a smaller window at the ends with min_periods=1). A day is unusual when it differs from that rolling median by more than 50% of the rolling median.
Store the unusual dates as text YYYY-MM-DD in a list in result.
import pandas as pd
daily = pd.DataFrame({
"date": pd.date_range("2025-10-01", periods=21, freq="D"),
"orders": [120, 118, 125, 130, 122, 119, 127, 124, 410, 126, 121,
123, 20, 128, 125, 131, 122, 127, 124, 129, 126],
})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.