This project performs a cohort analysis on provided data.
It imports data from the files customer.csv
and orders.csv
to a SQLLite database (if
not already done) and accesses them via the Peewee ORM. It then processes the order &
customer data to produce a file analysis.csv
with a cohort analysis, with the cohorts
being bucketed into ISO weeks in the default timezone ('US/Pacific').
This package uses pipenv to install its dependencies.
pipenv install
pipenv run python cohort_analysis.py
This outputs a CSV to stdout-- tee or pipe to a file to save, e.g.
pipenv run python cohort_analysis.py | tee analysis.csv
This project can also be Dockerized. Build with:
docker build . --tag "cohort_analysis"
Run with:
docker run cohort_analysis | tee cohort_analysis.csv
Test with:
docker run cohort_analysis pipenv run py.test
pipenv install --dev
pipenv run py.test
Note that the current version of Peewee has a DeprecationWarning that will be fixed in the next release