Data and reporting

How to Write a Python Data Analysis Report

See what a checkable analysis report includes, with a worked example covering denominators, missing records, and reproducible methods.

Put the main result and its denominator in the first paragraph of a data analysis report. Follow with a table of counts, a description of how you selected records, and any gaps that could change the conclusion. Keep a record of the input and the code so someone else can check the result.

Write the finding before choosing a graph

Say a building manager needs to know which rooms exceeded their reserved hours during a month. “Room B had 32% overrun” sounds precise, but the reader cannot tell whether 32% refers to reservations, minutes, or spending. A sentence with a unit is stronger. “Room B exceeded the scheduled end time on 16 of 50 April bookings with recorded checkouts (32%).” The question and the data now fit together.

Then address coverage. If Room B had 60 bookings and 10 lacked checkout records, place those numbers beside the result. A department that records checkout only when events run late can look worse under a measure based solely on completed records. Include a known limitation near the finding where a reader skimming the report can see it.

Show the counts behind the percentage

Make one row per comparison group. Include bookings in scope, bookings with known outcomes, bookings missing outcomes, and bookings with late checkout. The first number should reconcile with known plus missing, if these are the only dispositions. Include units in headings and keep percentages beside counts. When a group has zero known outcomes, show “unavailable” rather than a percentage.

Write interval boundaries down. A local calendar month starts at the building’s midnight, even if the event system records UTC. An event exactly at midnight on the first day of the next month belongs in the next month under a start-inclusive, end-exclusive reporting convention. Specify whether records are grouped by booking date, actual check-in date, or scheduled end date. These choices can change the result without causing a software error.

Add a visual when it helps a reader compare

Use labeled bars to compare a handful of rooms, with a rate above each bar and a companion count in the table. A trend across months needs comparable source coverage and a clear date axis. If the data source missed a month, draw that as a gap. A chart can illustrate a pattern even when the evidence does not support a causal explanation. Its caption should state the observed comparison and what records it excludes.

Save chart data as a small, machine-readable file when the analysis can be shared. That makes it possible to inspect exact values without interpreting pixels. If the records include sensitive information, share aggregate results consistent with the intended audience and keep the restricted source in its proper location. Small groups sometimes reveal more than their size suggests.

Record how to reproduce the result

Record the input source and its reporting period, the script or notebook version, the command you used, dependencies, exclusion rules, output names and the main validation checks. A useful handoff says “run this command on the approved April extract” and identifies which extract was used. If a colleague reproduces your counts with a later corrected export, their output may legitimately differ. Explain how to match an output with its input version.

Check boundary records independently of the program. Create one synthetic example exactly at the scheduled end, one shortly after, one with no checkout, and one with a checkout earlier than check-in. Decide how each case appears in the release table. A second person should be able to calculate their contributions with a pencil. Tests are most valuable when expected outcomes come from the policy, not from the current function.

Show how a reasonable correction could affect the claim

Return to Room B. There are 16 known late bookings and 10 with missing checkout times. If all 10 missing records were on time, the total late share among all 60 bookings would be about 26.7%. If all 10 were late, it would be about 43.3%. These two values bound the result under those extreme assumptions. Neither is an estimate of what actually happened. The observed 32% remains the share among the 50 with recorded outcomes.

Consider what the reader needs to decide. If any plausible result would still place Room B above the threshold for reviewing its schedule, the missing records may not block that review. If a decision changes anywhere across the range, improving coverage has practical value. Present those choices directly. A decimal with another digit cannot compensate for missing observation.

Keep changes traceable between versions. When a corrected export arrives, record which counts changed and why. Update the finding if its meaning changes, even if the chart looks similar. If earlier versions were shared for a decision, keep them available under their publication date so a later reader can understand what was known at the time.

Describe currency or time normalization in the same way. If the analysis converts booking duration to minutes, document whether it rounded each duration first or converted group totals. A reviewer comparing the underlying rows may otherwise find a different total and spend time looking for a missing booking.

Separate observations from action

Close with what the report supports. “Consider a trial of longer booking slots for Room B” is a decision proposal. “Longer slots will reduce overruns” is a prediction that would need additional evidence. The report can include a proposed next observation window or a way to capture missing checkouts. A reader who understands the limitation can choose whether the existing evidence is enough to act.

Before a trial, define improvement using the original question. A lower share of late checkouts might mean the longer slots helped, or it might reflect fewer bookings and less competition for the room. Keep booking totals and late counts together. Use the same definition of late and record any changes in checkout procedures. Read how to validate the input and choose a denominator.

Sources and further reading

Related reading

Browse Data and reporting · Explore project tutorials

Search PythonProjects.org