This project explores various Python libraries that can be used to create pivot tables and pivot charts, comparing their:
- (?) Ease of Use: How intuitive is the API?
- (?) Functionality: What features do they offer?
- (?) Performance: How fast are they with different dataset sizes?
- (?) Output Quality: What kind of visualizations can they produce?
- The Python examples generate HTML files into docs/
- GitHub Actions (CI pipeline) add some css style and then deploys everything in docs/ to GitHub Pages: https://toaaot.github.io/python-pivotchart-lib-comparison/
- pandas - Data manipulation with pivot tables
- plotly - Interactive visualizations
- pivottable.js - Interactive client-side pivot tables (JavaScript)
- ...
- Understand how pivot tables work
- Learn different approaches to data aggregation
- Compare visualization libraries
- Analyze performance trade-offs
- Create reproducible data analysis examples
- Python 3.8 or higher
- pip package manager
Step 1: Clone & Setup Locally
$ git clone https://github.com/toaaot/python-pivotchart-lib-comparison.git
$ cd python-pivotchart-lib-comparison
Step 2: Create & Activate Virtual Environment
$ python -m venv venv
$ source venv/bin/activate # On Windows: venv\Scripts\activate
Step 3: Install Dependencies
$ pip install -r requirements.txt
Step 4: (optional) Run Unit Tests locally
$ pytest tests/ -v
Step 5: Create HTML file locally for the individual examples.
Each library has its own example file in the examples/ directory.
$ python examples/bokeh_example.py
$ python examples/pivottablejs_example.py
$ python examples/hvplot_example.py
$ python examples/plotly_example.py
- Using the default "pages build and deployment" workflow
- This workflow is automatically triggered when you push to the branch configured for GitHub Pages in your repository.
- this workflow uses "actions/jekyll-build-pages" and "actions/pages-deploy"
- config: https://github.com/toaaot/python-pivotchart-lib-comparison/settings/pages
- runs: https://github.com/toaaot/python-pivotchart-lib-comparison/actions/
NOTE:
The default "pages build and deployment" workflow will not run the python scripts in our project.
- run "jekyll build" which converts Markdown and Liquid template files into static HTML, CSS, and JavaScript files
- package them into an artifact compatible with GitHub's deployment system
- supports Jekyll themes
NOTE:
If you have a ".nojekyll" file in the root of your repository, this default action will be skipped
python-pivotchart-lib-comparison/
├── data/
│ └── game_sessions.csv
├── src/
│ ├── __init__.py
│ ├── main.py
│ ├── data_loader.py
│ ├── bokeh_example.py
│ ├── pivottablejs_example.py
│ ├── hvplot_example.py
│ └── plotly_example.py
├── docs/ # GitHub Pages content
│ ├── index.html # Landing page with links
│ ├── bokeh.html # Generated by bokeh example
│ ├── pivottablejs.html # Generated by pivottablejs example
│ ├── hvplot.html # Generated by hvplot example
│ ├── plotly.html # Generated by plotly example
│ └── plotly.min.js # Generated by plotly example
├── tests/
│ ├── __init__.py
│ ├── pytest.ini
│ ├── test_data_loader.py
│ └── test_examples.py
├── LICENSE
├── README.md
├── TODO.md
├── requirements.txt
└── .gitignore
- Pandas Pivot Tables: https://pandas.pydata.org/docs/reference/api/pandas.pivot_table.html
- Plotly Documentation: https://plotly.com/python/
- pivottablejs ... XXX
- bokeh ... XXX
- Getting started with GitHub Pages: https://docs.github.com/en/pages/getting-started-with-github-pages
- "pages build and deployment" workflow: https://github.blog/changelog/2021-12-16-github-pages-using-github-actions-for-builds-and-deployments-for-public-repositories/