Learning Outcome Statement
Describe objectives, steps, and examples of preparing and wrangling data.
On the exam: This is a case-based constructed-response item. The vignette gives source systems, row grain, periodicity, identifiers, units, missingness, and defects. It asks you to describe the preparation objective, the wrangling sequence, or the validation and output that fit those facts.
Raw files rarely share the same meaning. Preparation protects field meaning, while wrangling arranges compatible records at the target grain without silently changing an observation. Your objective is a dataset with a known row grain, aligned fields, and a traceable path from raw values to output. A table can look complete and still be wrong when a periodicity mismatch or a zero-for-missing choice changes the meaning.
| Source fact | Inspect | Preparation action |
|---|---|---|
| Record grain | One row per target unit | Preserve target row grain |
| Identifiers | Codes and join keys | Map before combining |
| Dates | Observation and as-of dates | Align date meaning |
| Frequency | Annual or monthly | Apply stated frequency rule |
| Units | Basis points or decimals | Convert and record scale |
| Missingness | Blank, zero, unavailable | Assess cause first |
| Defects | Duplicates and ranges | Correct or quarantine |
These checks protect meaning, not just formatting. They tell you whether records can be joined and what a blank means.
When a source quotes a credit spread in basis points, call the observed value $S_{\mathrm{bps}}$. To convert basis points into a decimal, divide by the number of basis points in one decimal. Call that divisor $B$, and call the cleaned decimal spread $S_{\mathrm{dec}}$. The conversion is:
$$ S_{\mathrm{dec}}=\frac{S_{\mathrm{bps}}}{B} $$
Division changes the unit, not the observation date or economic meaning. A larger $S_{\mathrm{bps}}$ raises $S_{\mathrm{dec}}$. A larger $B$ lowers it. Record $B$ with the transformation so another analyst can reproduce the result.
Apply a purpose-first sequence. Set the target row grain, inspect every input, clean and standardize fields, combine or reshape only after alignment, validate after each major transformation, and document the rules and exceptions.
Loading diagram…
Keep raw data immutable. Build the prepared output in a separate layer, and make every transformation reproducible and traceable. Do not delete, impute, or set missing values to zero until you have assessed their cause and meaning. Align identifiers, dates, units, frequency, and periodicity before combining sources.
Validation travels with the workflow, not just the end. After each major transformation, check keys, duplicates, ranges, row counts, and semantic meaning. Document the output grain, source dates, conversion rules, and exceptions.
Worked example
You are handed four month-end issuer records. Each record carries a positive credit spread quoted in basis points, and the target research dataset needs a decimal spread for the same observation date. The records are a sample of issuer-month observations. Describe the preparation sequence and produce the cleaned field.
| Given | Value |
|---|---|
| Record one spread | $120$ basis points |
| Record two spread | $180$ basis points |
| Record three spread | $240$ basis points |
| Record four spread | $310$ basis points |
| Basis-point scale | $B=10000$ basis points per decimal |
| Periodicity | Month-end, same source and cleaned dates |
| Observation set | Sample of issuer-month records |
| Target field | Decimal spread |
The four inputs share month-end timing, source, and cleaned dates, so the scale conversion changes units without changing the observations. Keep the records in their issuer-month order and apply the same divisor to each one. The resulting pattern should rise with the raw spreads; a different shape would prompt you to recheck the row mapping or arithmetic.
Loading diagram…
Read the plotted points as the cleaned values attached to records one through four, rather than as a time-series trend beyond this sample. The first point is $0.0120$ and the last is $0.0310$; the two middle records fall between them. The table below makes each record-to-value pairing explicit, which is useful when checking that no rows were reordered during preparation.
| Record | Cleaned spread |
|---|---|
| $1$ | $0.0120$ |
| $2$ | $0.0180$ |
| $3$ | $0.0240$ |
| $4$ | $0.0310$ |
- Inspect the raw layer and freeze its grain. Confirm that the four rows are month-end issuer-month observations with the same source and cleaned dates. The row-count check produces $4$ and rules out an annual-to-monthly conversion.
- Convert record one into decimal units. Call its result $S_{\mathrm{dec},1}$ and divide by $B=10000$, producing $S_{\mathrm{dec},1}=\frac{120}{10000}=0.0120$. This makes the field comparable with other decimal fields.
- Apply the same scale to record two because its date and grain are unchanged. The result is $S_{\mathrm{dec},2}=\frac{180}{10000}=0.0180$.
- Apply the same scale to record three. The result is $S_{\mathrm{dec},3}=\frac{240}{10000}=0.0240$.
- Apply the same scale to record four. The result is $S_{\mathrm{dec},4}=\frac{310}{10000}=0.0310$.
- Keep raw and cleaned fields on the same issuer-month row because their dates already align. Validate the issuer-month key, duplicates, range, row count $4$, and semantic meaning, then document the scale and date rule.
The prepared dataset now contains the decimal field shown in the output table while the raw field remains available for traceability. You can compare these issuer-month spreads without confusing a unit conversion with a change in the observation.
Now consider a risk committee deciding whether an apparent difference in its spread screen reflects a market move or a unit mismatch. It receives the raw basis-point field and the cleaned decimal field for the same issuer-month observations. The conversion produces the four cleaned values in the output table, so the committee uses the decimal field for comparison and the raw field as audit evidence rather than treating the display difference as a change in credit conditions.
Changed condition
You receive the same issuer-month data, but record three's raw spread changes. The scale and date rule stay fixed. Predict the cleaned value before you look at the result.
| Field | Original | Changed |
|---|---|---|
| Raw spread, record three | $240$ basis points | $260$ basis points |
| Cleaned spread, record three | $0.0240$ | $0.0260$ |
Only record three should move upward. The raw quote is higher, and division by the same positive $B$ carries that increase into the decimal field. Before reading on, list the identifier, duplicate, range, row-count, and semantic checks you would run after this change.
Common error
You may repeat an annual fundamentals value across every monthly row and mistake those copies for monthly observations. That can feel right because the monthly table looks complete and the join produces no blanks. Watch for a vignette that labels the field annual or gives different source periodicities while the target dataset is monthly. In that case, apply an explicit as-of or frequency rule before you combine the datasets.
Check yourself
Practice
An analyst builds a monthly issuer dataset from a price file and an annual fundamentals file. The identifiers, dates, units, and missing-value conventions differ. The analyst must preserve raw data and deliver a traceable output.
Question 1
Which objective best fits the analyst's preparation task?
Question 2
After inspection, which sequence is most appropriate?
Question 3
An annual fundamentals field will join monthly records. What should the analyst do before combining?
Question 4
Which checks best validate an output after a major transformation?
Record three changes from 240 basis points to 260 basis points. The scale remains 10000 basis points per decimal. Which cleaned value follows?
Revision snapshot
Purpose → inspect → clean and standardize → combine or reshape → validate → document. Keep raw data immutable. Make every transformation reproducible and traceable. Do not delete, impute, or set missing values to zero until their cause and meaning are assessed. Align identifiers, dates, units, frequency, and periodicity before combining sources. Validate keys, duplicates, ranges, row counts, and semantic meaning after each major transformation. For basis-point conversion, use $S_{\mathrm{dec}}=\frac{S_{\mathrm{bps}}}{B}$. On the exam, read the row grain, periodicity, identifiers, units, missingness, and defects before choosing a sequence. Annual data are not monthly observations without an explicit as-of or frequency rule.
Unlock the full lesson and continue reading
Signup to continue reading this lesson and unlimited access questions, flashcards, AI notes, and more