Guidelines to Standardize ESG Data (E for Environment Data)

Garbage In, Wrong Footprint Out: How to Harmonize Mixed Activity Data for Carbon Forecasting
A practical Python pipeline using Pint, Median Absolute Deviation, and schema-enforced emission factor joins to clean messy ESG data.

Suppose you want to train a time-series model to forecast to forecast your company’s Scope 1 and Scope 2 greenhouse gas emissions. Suddenly the model forecast shoots up by 1000x in the middle of the year. What must have happened ?Is there something wrong in the manufacturing unit ?Did a manufacturing plant suddenly start burning ten times more fuel?
No. Someone in a regional office entered a monthly electricity bill in megawatt-hours (MWh) instead of kilowatt-hours (kWh).
In carbon accounting and ESG data science, almost every calculation comes down to one core formula:
Emissions (CO₂e) = Activity Data × Emission Factor
When data scientists build emissions forecasting models, it is tempting to jump straight to Prophet, SARIMA, or gradient-boosted trees. In practice, however, the accuracy of any carbon forecast depends far more on what happens before modeling begins. Corporate sustainability data arrives fragmented across utility PDFs, fleet fuel cards, ERP procurement ledgers, and facility spreadsheets—each using different units, regional standards, and naming quirks.
In this article, we will build an audit-ready unit harmonization pipeline in Python that normalizes mixed activity data, catches 1,000x unit slips before they corrupt your baseline, and safely joins records with versioned emission factor tables.

Why Unit Standardization Is Hard in ESG Data
Unlike clean sensor telemetry from a single IoT system, corporate activity data spans multiple physical dimensions and regional conventions:
• Electricity & Heating: Smart meters log kWh, while regional utility invoices arrive in MWh, GJ, therms, or CCF (hundred cubic feet).
• Fleet & Stationary Fuels: Fuel logs mix liters, US gallons, and Imperial gallons.
• Purchased Goods & Freight: Procurement ledgers vary between kg, lbs, metric tonnes (MT), and US short tons.
• Text & Formatting Chaos: Manual spreadsheet uploads introduce inconsistent labels like "kWh", "KWH", "kw-h", "Metric Ton", and "t".
If unstandardized activity tables are feeded into a forecasting model—or multiplied against emission factors whose denominators don't match—your model ends up learning accounting errors instead of real operational trends.

Architecture of the Harmonization Pipeline
Instead of maintaining fragile, hardcoded if/else multiplication dictionaries, a production-grade ESG preprocessing pipeline should enforce five sequential stages:

  1. Raw Lineage Preservation: Ingest raw values and units without overwriting source fields.
  2. Canonical String Mapping: Map free-text unit aliases to a controlled vocabulary.
  3. Dimensional & Domain Conversions: Use Pint (Python Library)for physical unit math and lookup tables for fuel calorific values.
  4. Scale-Slip Anomaly Detection: Use Median Absolute Deviation (MAD) to quarantine 100x/1,000x data-entry errors.
  5. Schema-Enforced Emission Factor Joins: Programmatically assert that activity units match emission factor denominators before multiplying.

Step 1: Ingest Raw Activity Data (and Keep Lineage)
Let’s create a sample pandas DataFrame representing messy operational inputs across multiple facilities. A golden rule in sustainability engineering is never overwrite raw inputs—third-party auditors will always ask to trace normalized figures back to the original utility bill.

PYTHON CODE
import numpy as np
import pandas as pd
import pint

Initialize Pint's unit registry

ureg = pint.UnitRegistry()
raw_data = pd.DataFrame({
"facility_id": ["FAC-01", "FAC-01", "FAC-02", "FAC-03", "FAC-04", "FAC-05"],
"region": ["IN-WEST", "IN-WEST", "US-EAST", "IN-WEST", "GLOBAL", "EU-CENTRAL"],
"reporting_year":,
"activity_type": [
"electricity", "electricity", "natural_gas",
"diesel_fleet", "steel_purchased", "electricity"
],
"raw_value": [12500.0, 14.2, 450.0, 1200.0, 5.5, 9800.0],
"raw_unit": ["kWh", "MWh", "therms", "gal", "Metric Ton", "kw-h"]
})

Publishing the Code for next 4 steps in the coming Posts.