CHAPTER 37: Honest missing values and visible filter behaviour

37a: Make a zero and an unavailable result look different
37b: A filter changes the rows before the calculation

HOW TO RUN
Open a terminal in the extracted companion folder, the folder containing
automation, sql and visual_labs. Run:

    python visual_labs/ch37/walkthrough.py

Use python3 or py instead of python if that is the command established in
Chapter 15. No extra Python package is needed. Run it only after predicting
the displayed states. The exact output is also in expected_output.txt.

When a lab imports the automation examples, its short Path/sys.path setup
locates those existing modules relative to this file. It changes where this
Python process looks for imports; it does not change your operating-system
configuration. Preserve the extracted folder structure.

SOURCE AND MEANING
Board 37a uses three explicitly separate tiny synthetic rows. The existing
HTML builder is called with those rows and its output is checked in memory;
no HTML file is published or changed. Board 37b reads campaigns.csv and applies
selections in Python. This reproduces the arithmetic behind the filters,
not a claim to automate or test a Power BI, Tableau or Looker Studio account.

FOLLOW BEFORE YOU RUN
Draw three table rows for EUR 100 / 4, EUR 100 / 0 and EUR 0 / 4. Write the
label each should display before drawing any bars. At four pixels per euro,
the first bar has width 100 pixels; explain why the other two require distinct
text despite having no visible length.

PREDICT, RUN, COMPARE
Predict the combined measure for the tiny examples. Then choose Email in the
real campaign fixture: cross out the two unselected rows on paper and add only
what remains. Clear the selection and repeat. The script prints each state.

ONE MORE INPUT TO REASON THROUGH
Select Organic search only. Predict cost, enquiries and cost per enquiry.
To check in code, make a copy called practice.py in this same ch37 folder and
add "Organic search" to the selection list, leaving the source CSV untouched.

EXPLAINED ANSWER
Only Workplace guide remains: EUR 200, 10 enquiries and EUR 20.00 per enquiry.
Changing the selection changes included records, not the formula. If any card
still shows EUR 620, that card has not adopted the intended selection.

OPTIONAL VISUAL CHECK
From the companion root run: python automation/chapter37_dashboard.py
Open automation/output/dashboard.html. This creates the original baseline
dashboard locally, with no account or plotting-package requirement. It is the
chapter's full dashboard example rather than the tiny lab's three cases.

EXPECTED OUTPUT (verified by execution)

37a: Tiny independent display cases
Normal example: EUR 25.00; bar width 100 pixels
No enquiries: not available; no bar
No allocated cost: EUR 0.00; bar width 0 pixels
Combined: EUR 200.00 / 8 enquiries = EUR 25.00
The existing HTML builder preserves missing and zero labels.
37b: Select rows, then recalculate
All channels: EUR 620.00; 30 enquiries; EUR 20.67 per enquiry
Email: EUR 120.00; 8 enquiries; EUR 15.00 per enquiry
Paid search: EUR 300.00; 12 enquiries; EUR 25.00 per enquiry

All data in this lab are fictional teaching examples.
