This Python script is designed to efficiently parse, transform, and process NEM12 CSV files into structured and analyzable formats using pandas
. It supports multi-interval energy readings and prepares output files for deeper inspection and analysis.
The NEM12 Data Processor streamlines the extraction of energy meter data from NEM12-formatted CSVsβstandard files used by electricity retailers in Australia. It processes multiple interval data types like E1
, Q1
, B1
, and K1
, and outputs clean, timestamped CSVs ready for analysis or integration into data pipelines.
- Reads NEM12 CSV input containing interval records.
- Parses and categorizes data by NMI suffix (E1, Q1, B1, K1).
- Dynamically constructs timestamped dataframes based on the interval duration (e.g., 5, 10, 15, 30 minutes).
- Outputs intermediate CSVs for each reading type.
- Merges all dataframes into:
- Individual interval-specific datasets (e.g.,
inspectionE1.csv
) - A consolidated dataset (
finalResult.csv
) combining all readings on a common timestamp.
- Individual interval-specific datasets (e.g.,
- β
Parses NEM12 CSV files with
200
,300
, and900
markers - β
Extracts interval readings (
E1
,Q1
,B1
,K1
) - β Supports multiple interval durations (5, 10, 15, 30 minutes)
- β Automatically generates timestamps
- β Merges and cleans dataframes
- β Outputs clean CSVs ready for analysis
- β Deletes intermediate files after processing
.
βββ NEM12processor.py # Main script
βββ /Nem12/
β βββ /samples/
β βββ Copy 1.csv # Input file (NEM12 format)
βββ /output/
β βββ inspectionE1.csv
β βββ inspectionQ1.csv
β βββ inspectionB1.csv
β βββ inspectionK1.csv
β βββ finalResult.csv # Final combined dataset
βββ README.md # Project documentation
βββ LICENSE # MIT License file
- Python 3.7+
- pandas
Install dependencies:
pip install pandas
## π Output Example
| timestamp | E1 reading | Q1 reading | B1 reading | K1 reading |
|---------------------|------------|------------|------------|------------|
| 2024-01-01 00:00:00 | 123.45 | 456.78 | NaN | 321.65 |
| 2024-01-01 00:30:00 | 124.10 | 458.22 | NaN | 322.12 |