SQL statistics functions for Datasette
Project description
datasette-statistics
SQL statistics functions for Datasette
Installation
Install this plugin in the same environment as Datasette.
$ datasette install datasette-statistics
Usage
This plugin adds new SQL aggregate functions for use within Datasette:
statistics_mean()
for calculating the meanstatistics_geometric_mean()
for calculating the geometric mean (requires Python 3.8+)statistics_median()
for calculating the medianstatistics_median_low()
for calculating the low medianstatistics_median_high()
for calculating the high medianstatistics_mode()
for calculating the modestatistics_stdev()
for calculating the sample standard deviationstatistics_pstdev()
for calculating the population standard deviationstatistics_variance()
for calculating the sample variancestatistics_pvariance()
for calculating the population variance
These all use the implementations from the Python statistics library.
Use them like this:
select statistics_mean(numeric_column) from mytable
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-statistics
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv
:
pipenv shell
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for datasette_statistics-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d2d3899db5990a27a9f3b91d534f08ac46c7c685c1b5054757ec54af1c7cbec |
|
MD5 | 3e8eec2c7f13c081a6e55af78a661254 |
|
BLAKE2b-256 | a5755a557075082de8c15a31d3a7f129ebde78fcefe2e2fce41cdc738c52fabb |