Skip to content

Single-file C++17 tool that reads a CSV, extracts a numeric column, and prints stats (count, invalid rows, min, max, mean, median, stddev). No external libs. Includes sample data and CI.

Notifications You must be signed in to change notification settings

aliyahscoding/cpp-csv-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic C++ CSV Parser + Stats

CI — build and smoke test

Tiny C++17 program that reads a CSV, pulls a numeric column, and prints summary stats (count, invalid rows, min, max, mean, median, stddev).

Repo Layout

cpp-csv-stats/ ├─ data/ │ └─ sample.csv ├─ bin/ ├─ main.cpp ├─ Makefile # Option A ├─ CMakeLists.txt # Option B ├─ .gitignore └─ README.md

Build & Run

Option A: g++ + Make

Requires a working g++ and make.

make
./bin/csv_stats.exe data/sample.csv value



Option B: CMake
Requires CMake and a C++ compiler (MSVC, MinGW, or Clang).
mkdir build
cd build
cmake ..        # or: cmake -G "MinGW Makefiles" ..
cmake --build .
# On Windows, executable is in build/Debug or build/Release or build/ (depends on generator)

One-liner without Make/CMake
g++ -std=c++17 -O2 -Wall -Wextra -o bin/csv_stats.exe main.cpp
./bin/csv_stats.exe data/sample.csv value

CLI
csv_stats.exe <path_to_csv> [column_name]
# defaults: csv = data/sample.csv, column = value

Notes
Splits by comma only (no full RFC 4180 quoting). Good enough for simple data.
StdDev here is population standard deviation. Change to sample by dividing by (n-1).

About

Single-file C++17 tool that reads a CSV, extracts a numeric column, and prints stats (count, invalid rows, min, max, mean, median, stddev). No external libs. Includes sample data and CI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published