Skip to content

SpezioC/statistic-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statistical Data Processor

A small Python program for processing and analyzing numeric datasets. It can take input either from the command line or from CSV/JSON files. The operations are organized around a simple state machine.


Project Structure

├── main.py # Entry point
├── work/
│ ├── ops.py # Statistic operation
│ ├── io_utils.py # Input da CLI / CSV / JSON and output
│ └── init.py
├── user_interface/
│ ├── menu.py # Menu control (CLI)
│ └── init.py
├── tests/
│ ├── test_ops.py # Operation test
│ └── test_io_utils.py # Test I/O
└── pytest.ini

How to Run

python3 main.py

Main Components

Datablock (work/ops.py)

Stores data and provides statistical operations. Uses a function dictionary to avoid repeated calls. Implements:

  • Count, Sum, Min, Max, Mean
  • Median, Mode
  • Variance, Standard deviation
  • Quantile, Interquartile range
  • z-Scores
  • Covariance and Correlation (for paired datasets)

I/O utilities (work/io_utils.py)

  • Manual numeric input
  • Load from CSV or JSON (with automatic header handling)
  • Save results to file (JSON or CSV)

CLI Interface (user_interface/menu.py)

  • Text-based interaction
  • Controlled by a simple state machine in main.py

Tests

Unit tests implemented with pytest.
Run from the project root:

pytest -q

All current tests (9 total) validate both the mathematical correctness and file-handling robustness.

Design Notes

The point of this project was mainly to practice clean module separation and state-based control. Whit This layout allows adding new features or replacing components without modifying the entire codebase.

Known Limitations

  • JSON loader returns full Datablock objects; no partial loading yet.
  • Numeric input validation is minimal.
  • UI is CLI-only (no GUI, no API).

Author’s Note

This code was developed to practice a clean modular workflow and will serve as a base for future projects.

About

CLI modulare per analisi statistiche con test PyTest

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages