| Course | BU 451 Programming for Business Analytics |
|---|---|
| Unit | Unit 3 |
| Paper type | Cleaning and transformation in code |
| Length | About 870 words, 6 pages |
| Format | APA 7 student paper |
| School | Herzing University |
| Program | BS in Business Analytics |
| Updated | September 2026 |
Free sample paper for BU 451 Unit 3
Seven Fixes, Each Printing What It Touched: Cleaning and Transformation in Code for a Composite Paddle Rental Company's Season Data, With the Raw File Left Alone
Student Name
Business, Herzing University
BU 451: Programming for Business Analytics
Instructor Name
February 11, 2026
Seven Fixes, Each Printing What It Touched: Cleaning and Transformation in Code for a Composite Paddle Rental Company's Season Data, With the Raw File Left Alone
The Rules This Script Follows
Script 03_clean.py prepares the 2025 rental data for Riverbend Paddle Co., the invented river rental business this course follows, so the analysis can begin. The inspection script found prices stored as text, site codes in two cases, dates stored as text, 263 missing return times and codes still to be checked against the fleet list. This script fixes each problem in code under three rules. Nothing is corrected by hand in a spreadsheet. The raw data are loaded into one object that is never modified, and every change is made to a copy. And each change prints the number of records it touched and carries a comment naming the later step that needs it.
Broman and Woo (2018) recommend never editing raw data and recording every transformation, because a change made by hand leaves no trace a reader can check. Wickham (2014) describes the goal of this kind of work as tidy data: each variable in its own column, each observation in its own row and each value of the right type, which is what the analysis scripts will assume.
The Fixes
The script starts by loading the raw file exactly as the inspection script did and making a working copy with rentals = rentals_raw.copy(). The fixes below run in the order shown; each line of the table corresponds to a block in the script.
| Fix | Essential code | Records touched | Needed later for |
|---|---|---|---|
| 1. Price to a number | rentals["price"] = pd.to_numeric(rentals["price"].str.replace("$", "", regex=False)) | 412 | Revenue by site and month (Units 5 and 6) |
| 2. One case for site codes | rentals["site_id"] = rentals["site_id"].str.upper() | 57 | Grouping by site (Unit 5) |
| 3. Dates as dates | rentals["rental_date"] = pd.to_datetime(rentals["rental_date"]) | 18,640 | Joining weather by date (Unit 5) |
| 4. Duration in hours | Parse start and return times; subtract; divide by 3,600 seconds | 18,377 computed; 263 left missing | Utilization analysis (Unit 6) |
| 5. Impossible durations flagged | Durations below zero or above 12 hours set to missing and flagged | 14 | Utilization analysis (Unit 6) |
| 6. Double-entered rentals removed | Rows identical in every column except the rental number, removed after review | 21 | Counts and revenue (Units 5 and 6) |
| 7. Complimentary rentals flagged | rentals["comp"] = rentals["price"].eq(0) | 9 | Average price calculations (Unit 6) |
Each block ends with a print statement such as "Fix 1: 412 prices converted from text", and the same line is written to a cleaning log. After all seven fixes, the script checks the result: the price column is numeric with no missing values, every site code is one of the three in the sites file, every craft type code appears in the fleet file, and the number of rows is 18,619, the original 18,640 less the 21 removed duplicates.
Decisions That Needed Judgment
Three of the seven fixes involved choices rather than mechanical corrections, and each choice is written in a comment beside the code.
The 263 rentals with no return time were kept, not removed. Their prices, sites and dates are valid, so dropping them would understate revenue and rental counts by about 1.4 percent. Their duration is simply left missing, and the utilization analysis will exclude them while noting how many were excluded. The inspection showed that 211 of the 263 came from the CHA-3 site, which suggests a logging habit at that site rather than random loss; the note is passed on for the manager.
Fourteen rentals had a return time before the start time or a duration longer than twelve hours, which the company's longest rental package does not allow. Most look like morning and afternoon confused in manual entry. Rather than guess the correct time, the script sets their duration to missing and adds a flag, so the records remain in counts and revenue.
The 21 duplicates were removed only after review. They were rows identical in every field except the rental number, all at CHA-3 and all on the July 4 holiday, when walk-up rentals were entered in a rush. A duplicate that differed in any field, such as party size, was kept, since two genuinely similar rentals are possible on a busy day.
Why Not Fix It in a Spreadsheet
Several of these fixes would take less time by hand. Opening the file in a spreadsheet, finding the dollar signs and deleting them, or sorting by site code and retyping the lower-case ones, might take ten minutes. The cost appears later. A hand edit leaves no record of which cells changed, so if a figure in the final report looks wrong, nobody can tell whether the problem lies in the data or in the edit. A hand edit also has to be repeated every time the file is refreshed, and it is rarely repeated in exactly the same way. And spreadsheets change data silently when they open files, for example by converting ZIP codes that begin with zero into numbers, the very problem the import script avoided. Writing each fix as code costs more at first, but the script documents itself, runs identically every time and leaves every change open to review.
What Is Written Out
The script writes two files. The cleaned table goes to data/processed/rentals_clean.csv, with three new columns: duration_hours, duration_flag and comp. The cleaning log goes to output/03_cleaning_log.csv, with one line per fix giving its number, description and the number of records touched. The raw file in data/raw is never opened for writing, and the script can be run any number of times with the same result. If the company later supplies a corrected export, replacing the raw file and rerunning the script reproduces every fix and a new log, and the two logs can be compared line by line. McKinney (2022) recommends this pattern, loading once, transforming a copy and saving the result under a new name, as the safest way to keep a data pipeline repeatable. Riverbend Paddle Co. and all of its records are composites for this course.
References
Broman, K. W., & Woo, K. H. (2018). Data organization in spreadsheets. The American Statistician, 72(1), 2-10. https://doi.org/10.1080/00031305.2017.1375989
McKinney, W. (2022). Python for data analysis: Data wrangling with pandas, NumPy, and Jupyter (3rd ed.). O'Reilly Media.
Wickham, H. (2014). Tidy data. Journal of Statistical Software, 59(10), 1-23. https://doi.org/10.18637/jss.v059.i10
BU 451 Unit 3 instructions, in plain terms
In the third unit, BU 451 asks students to clean and transform data using code rather than manual editing. Common requirements include preserving the raw data, making each correction in a script, reporting how many records each change affected, explaining decisions such as how to treat missing values, and saving a cleaned file. Many instructors ask whether spreadsheet cleaning is acceptable; most say no, because it leaves no record. Removing records with missing values is often questioned, and students should justify any removal. The submission usually includes the script, the cleaned output and a written explanation in APA 7, with a table linking each fix to its purpose and count.
How the BU 451 Unit 3 example is put together
The paper opens with the problems the inspection found and three rules the script follows. A table lists seven fixes with their essential code, records touched and the later analysis each supports. A paragraph describes how each fix prints a line to a log and how the script checks its final row count and codes. A section explains three judgment calls: keeping rentals without return times, flagging rather than guessing impossible durations, and removing duplicates only after review. A section explains why cleaning in a spreadsheet would cost more later. The final section describes the two files written and how a corrected raw export would be handled.
Where the points sit in the BU 451 Unit 3 rubric
Cleaning rubrics at Herzing generally reward preservation of raw data, fixes implemented in code, documented counts, justified decisions and a verified result, together with writing quality. Preservation earns full credit when the raw object is never modified. Code implementation scores highest when every change can be read in the script. Documented counts reward printing and logging how many records each fix touched. Justified decisions are judged on whether removals and flags are explained with evidence. The verification criterion earns points when the script checks its own output, such as final row counts and valid codes. Instructors often credit students who keep questionable records with flags rather than deleting them. A cleaning log that a reviewer can compare with the inspection report is one of the clearest signs of a strong submission.
BU 451 Unit 3 help before you submit
Cleaning scripts often lose points by overwriting the raw data, which makes the changes impossible to review. Another common problem is dropping every record with a missing value, quietly shrinking totals that did not depend on the missing field. Students frequently fix problems without saying how many records were affected. Some guess corrections, such as swapping morning and afternoon, instead of flagging uncertain values. Others remove near-duplicates that are actually separate transactions. Many never check the cleaned result against expected counts. Finally, using a file from a job for practice can expose customer information; a supplied dataset lets you show the same cleaning discipline without that risk.
Get a BU 451 Unit 3 example written to your instructions
Attach the rubric your section posts for BU 451 Unit 3, the instructions, and the dataset plus any inspection you already produced. The custom example works from a preserved copy, names each block by the defect it fixes, prints a count per change, keeps its mappings in the file and compares the result against the import. First one free, 24 to 48 hours.
More BU 451 papers and business analytics samples
- BU 451 Unit 1: Environment and setup exercise
- BU 451 Unit 2: Data import and inspection script
- BU 451 Unit 4: Control flow and functions
- BU 451 Unit 5: Aggregation and joins
- BU 451 Unit 6: Analysis script with output
- BU 451 Unit 7: Error handling and validation
- BU 451 Unit 8: Reproducible analysis submission
- BU 351 Unit 3: Descriptive analysis
- BU 407 Unit 3: Forecast selection record
- BU 454 Unit 3: Comparison and ranking charts
- BU 455 Unit 3: Storage and format decisions
BU 451 Unit 3 questions, answered
Can I do part of the cleaning in a spreadsheet if it is faster?
Faster once, and unreproducible afterward. The unit is graded on whether a second person can run your file and arrive at the same result, and a manual edit breaks that even when the edit was correct. If a change is easier to reason about as a table, work it out there and then write the rule into the script, so the reasoning is yours and the execution is the code's.
Should records with missing values be removed?
Only where the assignment says so or where you can state what removal costs. Print the count first, say whether the records lost share anything in common, and record the decision in a comment either way. Where the gaps look concentrated rather than scattered, keeping them and flagging the field is usually the stronger submission, since the loss would be uneven.
My job involves cleaning reports. Can I use one of those files?
The experience is useful and the files are not yours to hand over. A report pulled out of a work system stays the property of whoever runs that system, and coursework leaves the company the moment it is uploaded for grading. Use the supplied dataset for the graded artifact; anything you clean at work stays at work and is never something we draft.
Where can I find a free BU 451 Unit 3 sample paper?
The whole BU 451 Unit 3 cleaning and transformation example is free to read here, with the fix table, the judgment calls and margin notes. If your data problems differ, share the assignment and we write a matching cleaning write-up without charge, usually within two days.
Should BU 451 Unit 3 remove records with missing values?
Only when the missing field makes the whole record unusable. The sample keeps 263 rentals without return times because their prices, sites and dates are valid, and excludes them only from duration analysis.