00_Data_Prep (R) - Data Cleaning & Assumptions Setup

This step is now implemented in Code/01_Data_Prep.R (no longer in a Python notebook).

Expected Input

  • data/raw/macro_data.csv
  • data/raw/wmt_financials.csv
  • data/raw/wmt_segments.csv
  • data/raw/peers_comps.csv

Process

  1. Load raw data.
  2. Align fiscal year (adjustment when year-end is in January).
  3. Clean non-recurring items from EBIT and EBITDA:
  • restructuring charges
  • opioid settlements
  • gain on sale of assets
  1. Estimate macro assumptions and calculate WACC.
  2. Build master dataset for the models.

Outputs

  • data/processed/master_model_input.csv
  • data/processed/macro_data_clean.csv (if input exists)
  • data/processed/wmt_segments_clean.csv (if input exists)
  • data/processed/peers_comps_clean.csv (if input exists)
  • config/assumptions.csv
  • config/assumptions.yaml (if yaml package is installed)

Execution

From the project root:

Rscript Code/01_Data_Prep.R

Notes

  • If columns or files are missing, the script uses conservative defaults and issues warnings.
  • This step feeds Code/02_DCF.R and the rest of the models.