AAmit’s LibraryLEARN · PRACTISE · REFLECT

Lab catalogue · Library home

Four business-data lessons

Original synthetic CSV exercises with exact arithmetic and 30 scenario tests. No paid account, cloud service or external Python package is required. These four lessons implement bounded parts of four existing briefs, not every possible business workflow.

Prepare and run

Download all six files into one folder. Open a terminal in that folder. The script finds the CSV files beside itself and does not write to them.

business_data_practice.py · business_data_practice_test.py · practice_funnel.csv · practice_retention.csv · practice_forecasts.csv · practice_suppliers.csv

python3 business_data_practice.py
python3 -m unittest business_data_practice_test.py

Read one lesson, predict its outputs, then run and compare. Edit copies for the change exercises. Error messages identify the rejected contract; investigate the input rather than hiding the error. Browser notes, responses and attempted flags remain self-reported; use full learning export/import for backup.

Sales funnel: define the path before dividing

Expected: Counts 6 → 4 → 3 → 2; step rates 2/3, 3/4, 2/3; overall conversion 1/3.

File: practice_funnel.csv. Allow 45–75 minutes per lesson, excluding prerequisite study; this is a suggested planning block.

Orientation and prerequisite

A funnel studies progress through declared stages. In this exercise each of six synthetic lead identifiers has three flags: contacted, quoted and ordered. Every row belongs to the same eligible cohort and observation window. One means the stage was observed; zero means it was not. This is a closed nested fixture: an order requires a quote, and a quote requires contact. Basic fractions, Python functions and CSV headers are enough to begin. The goal is to calculate and interpret a coherent funnel, not to infer customer intent or implement a customer relationship system.

Inspect the data contract

Open the CSV as text and trace L1 through all three stages, L3 through contact and quote, and L5 through none. Count distinct leads rather than contact events. The lead_id identifies an observation; repeated identifiers are rejected because the fixture has no merge or event-reconciliation rule. Headers are exact and ordered. Missing fields, extra fields and flags other than 0 or 1 produce errors. These checks protect this classroom contract. They do not establish that every real lead is represented or that a recorded contact was meaningful.

Calculate and explain

Predict the totals before running: six leads, four contacted, three quoted and two ordered. Contact rate is 4/6; quotation rate among contacted leads is 3/4; order rate among quoted leads is 2/3. Overall conversion is 2/6. The three step rates multiply to the overall rate because the declared stages are nested for this cohort. Each denominator answers a different question. A non-nested or open funnel needs another contract. If a stage has zero eligible observations, its subsequent step rate is undefined, represented as None rather than silently reported as zero.

Managerial application and failure practice

Marketing, sales and delivery should agree on the definitions before comparing teams. A dropped stage can reflect missing follow-up, unsuitable demand, a delayed decision or incomplete observation. The counts do not explain the cause. Create a copy with ordered=1 and contacted=0, run it and explain the validation error. Add a repeated lead identifier and distinguish duplicate-record handling from repeat activity. Preserve the original file so the expected result remains reproducible. Discuss whom a restrictive sales target affects and what evidence would justify changing the process.

Portfolio, progression and free study

Submit the data dictionary, stage counts, four rates, one rejected case and a consultation memo identifying a feasible next investigation. For undergraduate study explain the calculations; for postgraduate study critique selection and window definitions; for research specify an outcome and comparison without inventing causality. The Google funnel guide is further free reading about a particular analytics product; this script does not connect to it or reproduce its full semantics. Ask who owns each stage, whose definitions apply, where missing observations originate, when follow-up occurs, which alternative is feasible and how feedback changes action.

Related chapter global-brief-03 · Related chapter global-brief-14 · Save response and attempted status

Customer retention: preserve the baseline cohort

Expected: Baseline cohort 3; retained 2; later-active 3; newly active 1; cohort retention 2/3.

File: practice_retention.csv. Allow 45–75 minutes per lesson, excluding prerequisite study; this is a suggested planning block.

Orientation and prerequisite

Retention concerns a defined group across a stated observation boundary. The five synthetic customer identifiers have baseline_active and later_active flags. In this fixture the baseline cohort consists of customers whose baseline flag is one. Retention counts members of that same cohort observed active later. A newly active customer can increase the later total without being retained from the baseline. Begin with set membership and fractions, then use Python to reproduce the calculation. The exercise does not estimate customer lifetime value, explain why customers return or represent a complete subscription model.

Inspect the data and membership

Trace C1 and C3 as baseline customers active later, C2 as baseline but not later active, and C4 as newly active later. C5 is active in neither period. Baseline size is three, retained size two, later-active size three and newly active size one. The later-active total happens to equal the baseline total, but it describes a different membership. The cohort rate is two divided by three. Dividing retained customers by all five rows would answer another question. State the meaning of active and the two periods before adapting this classroom file.

Missingness and boundaries

Zero means not observed active under this file’s contract; it is not a general diagnosis of churn or dissatisfaction. Missing values are rejected, because converting an unknown observation to zero would change the meaning. A baseline cohort of zero produces an explicit error rather than an invented retention rate. Repeated customer identifiers are rejected instead of silently merged. A real study would need identity resolution, a suitable time horizon, event definitions and treatment of incomplete observation. Consultation can reveal seasonal buying or delayed fulfilment that a two-flag table cannot explain.

Practical changes and departmental interpretation

Copy the file and change C4 from later_active=1 to 0. Predict that new-later and later-active counts change while the baseline retention rate stays two thirds. Then change C2 to later_active=1 and predict full observed retention within the baseline. Use both copies to distinguish acquisition from retention. Marketing may celebrate later activity, while support asks about the baseline experience; both need the membership boundary. The exercise should prompt investigation rather than label individual customers or employees as failures. No personal data is required.

Portfolio and deeper study

Submit a cohort membership table, the counts and rate, two changed scenarios and a decision memo. Explain whose activity definition applies, whom outreach might affect, where missing events arise, when the follow-up window closes, why the baseline is suitable and how a later observation changes the interpretation. At postgraduate level critique selection, identity and seasonal effects. For research define a comparable cohort and outcome before studying an intervention. The Python CSV documentation supports file handling; it is not a retention methodology course or evidence that these invented customers represent a market.

Related chapter global-brief-03 · Related chapter global-brief-08 · Save response and attempted status

Forecast comparison: score the same held-out observations

Expected: Baseline mean absolute error 10 and mean signed error 0; candidate mean absolute error 5 and mean signed error 2.5.

File: practice_forecasts.csv. Allow 45–75 minutes per lesson, excluding prerequisite study; this is a suggested planning block.

Orientation and prerequisite

A forecast should be evaluated against observations appropriate to its intended use. This exercise contains four synthetic period identifiers, actual values and two supplied forecast columns. It scores those columns on identical rows; it does not fit a model. The fixture assumes that the forecasts are valid comparison inputs, but cannot verify when they were produced. Understand subtraction, absolute value and averaging before running. The goal is to distinguish error size from signed direction and communicate what the small comparison supports.

Calculate before execution

For the baseline, forecast minus actual errors are -10, -10, 10 and 10. Their signed mean is zero because opposite directions cancel. Their absolute values are all ten, so mean absolute error is ten. Candidate errors are 5, -5, 5 and 5, giving mean absolute error five and signed mean 2.5. The candidate has a smaller observed absolute error on these four rows. A zero signed mean does not mean perfect forecasts, and an improved score on four rows does not guarantee better future decisions.

Define a fair comparison

Use the same actual observations, units and horizon for both columns. The CSV requires unique periods and nonnegative finite rational values under this demand-like fixture. Zero actual values are allowed because absolute error does not divide by actual demand. Missing values and negative forecasts are rejected under the stated contract. These rules are not universal for every forecasting domain. A real evaluation also needs appropriate development and held-out periods, prevention of future information leakage and an operationally relevant error measure. A file with three columns cannot prove those conditions.

Business consequences and failure practice

Operations may care about stockouts while finance worries about excess inventory. Mean absolute error treats equal-sized under- and over-forecasts equally; the business may not. Discuss error costs and feasibility before recommending a candidate. Copy the CSV, insert an invalid actual value such as nan and inspect the rejection. Change one candidate prediction and predict its absolute and signed effects. Do not choose a new model after inspecting every evaluation result and still describe the same observations as untouched held-out evidence. Keep the source and evaluation boundary clear.

Portfolio, extension and free learning

Submit the four errors for each column, both metrics, a changed scenario and a recommendation stating what evidence is missing. Explain who owns the planning choice, whose error costs apply, where actual values originate, when the forecast horizon matters, which alternative remains and how monitoring changes the decision. Postgraduate work should compare horizons, costs and distribution shifts; research should define a reproducible evaluation design. The scikit-learn mean-absolute-error reference is free further reading. The runnable script deliberately uses the standard library and does not require or train scikit-learn models.

Related chapter global-brief-08 · Related chapter global-brief-14 · Save response and attempted status

Supplier scorecard: inspect the weights and the omitted constraints

Expected: Weights 0.6/0.4: A=86, B=84. Weights 0.8/0.2: B=87, A=83. Preference reverses.

File: practice_suppliers.csv. Allow 45–75 minutes per lesson, excluding prerequisite study; this is a suggested planning block.

Orientation and prerequisite

A scorecard combines declared criteria under chosen weights. This synthetic exercise compares two suppliers on quality and delivery, each on an invented zero-to-one-hundred scale where higher is better. It assumes those scales can meaningfully be combined; that assumption needs justification in a real decision. There are no prices, contractual obligations, eligibility checks or actual supplier records. Begin with multiplication and addition, then use the script to inspect a preference and its sensitivity. The goal is a transparent comparison, not an automated procurement recommendation.

Work the initial calculation

Supplier A has quality 80 and delivery 95; supplier B has quality 90 and delivery 75. Under quality weight 0.6 and delivery weight 0.4, A scores 48 plus 38, or 86. B scores 54 plus 30, or 84. A leads on the declared weighted sum. Explain who selected the weights, what the scores represent and how evidence supports them. A two-point difference is not a confidence interval, an objective value advantage or proof that A will perform better under the organisation’s actual requirements.

Sensitivity and a reversed preference

Increase quality weight to 0.8 and reduce delivery weight to 0.2. A now scores 64 plus 19, or 83, while B scores 72 plus 15, or 87. B leads. This reversal demonstrates sensitivity to priorities; it does not show that either weighting is correct. Consult purchasing, operations, finance and relevant users about acceptable tradeoffs and essential constraints. Some requirements should be treated as eligibility gates rather than compensated by a high score elsewhere. This fixture does not implement those gates.

Validation and practical failure cases

The script requires finite nonnegative weights summing exactly to one and scores between zero and one hundred. It rejects missing fields, repeated supplier identifiers and scores outside the range. Make a copy with quality 101 and inspect the error, then try weights 0.6 and 0.6. For a tie, the display orders identifiers alphabetically; this is a display rule, not a substantive winner. Distinguish a valid calculation from valid input evidence. A staff member can enter a plausible but unsupported score that the arithmetic cannot detect.

Portfolio and research direction

Submit the scale definitions, both weight scenarios, one rejected input and a decision memo listing omitted evidence. Ask who owns the decision, whom delay affects, whose scores are used, what is non-negotiable, where supporting evidence sits, when it must be reviewed, why weights fit, which alternative is feasible and how consultation changes the comparison. At postgraduate level critique compensability and measurement. For research examine whether explicit sensitivity analysis changes justified choices on comparable synthetic tasks. The Python rational-arithmetic documentation supports computation; it is not an established supplier evaluation framework or certification standard.

Related chapter global-brief-04 · Related chapter global-brief-05 · Save response and attempted status

Free primary learning

Selected freely readable guidance checked 5 October 2026. It does not establish certification access or a complete programme review. The scripts do not use Google Analytics or scikit-learn. Further learning providers and webinar directories remain available.