log has one row per till event: store_id, ts (a "YYYY-MM-DD HH:MM" string), sales (the amount sold) and stock (the stock level counted at that moment, or missing when no count was taken). Rows are in no particular order.
Write daily_store_report(log, start, end) returning one row for every store in the log and every calendar day from `start` to `end` (inclusive, "YYYY-MM-DD" strings), with:
- •
sales — the day's total sales; 0.0 on a day with no rows. - •
stock — the last stock count taken that day. On a day with no count, carry the most recent earlier count forward, but for at most 2 days; after that it's missing. Days before a store's first count are missing — never fill backwards, and never from another store.
Only rows dated start to end are used. Columns: store_id, day ("YYYY-MM-DD"), sales, stock. Sort by store_id, then day.
Python 3.13 in your browser — the standard library plus pandas and numpy; no pip installs.