datasette-statistics


Namedatasette-statistics JSON
Version 0.2.1 PyPI version JSON
download
home_page
SummarySQL statistics functions for Datasette
upload_time2023-11-30 23:35:54
maintainer
docs_urlNone
authorSimon Willison
requires_python>=3.6
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datasette-statistics

[![PyPI](https://img.shields.io/pypi/v/datasette-statistics.svg)](https://pypi.org/project/datasette-statistics/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-statistics?include_prereleases&label=changelog)](https://github.com/simonw/datasette-statistics/releases)
[![Tests](https://github.com/simonw/datasette-statistics/workflows/Test/badge.svg)](https://github.com/simonw/datasette-statistics/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-statistics/blob/main/LICENSE)

SQL statistics functions for Datasette

## Installation

Install this plugin in the same environment as Datasette.
```bash
datasette install datasette-statistics
```
## Usage

This plugin adds new SQL aggregate functions for use within Datasette:

- `statistics_mean()` for calculating the [mean](https://docs.python.org/3/library/statistics.html#statistics.mean)
- `statistics_geometric_mean()` for calculating the [geometric mean](https://docs.python.org/3/library/statistics.html#statistics.geometric_mean) (requires Python 3.8+)
- `statistics_median()` for calculating the [median](https://docs.python.org/3/library/statistics.html#statistics.median)
- `statistics_median_low()` for calculating the [low median](https://docs.python.org/3/library/statistics.html#statistics.median_low)
- `statistics_median_high()` for calculating the [high median](https://docs.python.org/3/library/statistics.html#statistics.median_high)
- `statistics_mode()` for calculating the [mode](https://docs.python.org/3/library/statistics.html#statistics.mode)
- `statistics_stdev()` for calculating the [sample standard deviation](https://docs.python.org/3/library/statistics.html#statistics.stdev)
- `statistics_pstdev()` for calculating the [population standard deviation](https://docs.python.org/3/library/statistics.html#statistics.pstdev)
- `statistics_variance()` for calculating the [sample variance](https://docs.python.org/3/library/statistics.html#statistics.variance)
- `statistics_pvariance()` for calculating the [population variance](https://docs.python.org/3/library/statistics.html#statistics.pvariance)

These all use the implementations from the [Python statistics library](https://docs.python.org/3/library/statistics.html).

Use them like this:
```sql
select statistics_mean(numeric_column) from mytable
```
## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd datasette-statistics
python3 -mvenv venv
source venv/bin/activate
```
Or if you are using `pipenv`:
```bash
pipenv shell
```
Now install the dependencies and test dependencies:
```bash
pip install -e '.[test]'
```
To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "datasette-statistics",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Simon Willison",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f8/17/f9ca64f1b86305c35226c71eb43b373143f7a8020c2bb72384cea16f4760/datasette-statistics-0.2.1.tar.gz",
    "platform": null,
    "description": "# datasette-statistics\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-statistics.svg)](https://pypi.org/project/datasette-statistics/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-statistics?include_prereleases&label=changelog)](https://github.com/simonw/datasette-statistics/releases)\n[![Tests](https://github.com/simonw/datasette-statistics/workflows/Test/badge.svg)](https://github.com/simonw/datasette-statistics/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-statistics/blob/main/LICENSE)\n\nSQL statistics functions for Datasette\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n```bash\ndatasette install datasette-statistics\n```\n## Usage\n\nThis plugin adds new SQL aggregate functions for use within Datasette:\n\n- `statistics_mean()` for calculating the [mean](https://docs.python.org/3/library/statistics.html#statistics.mean)\n- `statistics_geometric_mean()` for calculating the [geometric mean](https://docs.python.org/3/library/statistics.html#statistics.geometric_mean) (requires Python 3.8+)\n- `statistics_median()` for calculating the [median](https://docs.python.org/3/library/statistics.html#statistics.median)\n- `statistics_median_low()` for calculating the [low median](https://docs.python.org/3/library/statistics.html#statistics.median_low)\n- `statistics_median_high()` for calculating the [high median](https://docs.python.org/3/library/statistics.html#statistics.median_high)\n- `statistics_mode()` for calculating the [mode](https://docs.python.org/3/library/statistics.html#statistics.mode)\n- `statistics_stdev()` for calculating the [sample standard deviation](https://docs.python.org/3/library/statistics.html#statistics.stdev)\n- `statistics_pstdev()` for calculating the [population standard deviation](https://docs.python.org/3/library/statistics.html#statistics.pstdev)\n- `statistics_variance()` for calculating the [sample variance](https://docs.python.org/3/library/statistics.html#statistics.variance)\n- `statistics_pvariance()` for calculating the [population variance](https://docs.python.org/3/library/statistics.html#statistics.pvariance)\n\nThese all use the implementations from the [Python statistics library](https://docs.python.org/3/library/statistics.html).\n\nUse them like this:\n```sql\nselect statistics_mean(numeric_column) from mytable\n```\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd datasette-statistics\npython3 -mvenv venv\nsource venv/bin/activate\n```\nOr if you are using `pipenv`:\n```bash\npipenv shell\n```\nNow install the dependencies and test dependencies:\n```bash\npip install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "SQL statistics functions for Datasette",
    "version": "0.2.1",
    "project_urls": {
        "CI": "https://github.com/simonw/datasette-statistics/actions",
        "Changelog": "https://github.com/simonw/datasette-statistics/releases",
        "Homepage": "https://github.com/simonw/datasette-statistics",
        "Issues": "https://github.com/simonw/datasette-statistics/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "010d34986a50640d397e0951c8b49f89d81296665d487ecc1a4040280120cb41",
                "md5": "5e7e0dec790cb9a8ef96d52f654afd19",
                "sha256": "dce7da349cacc8bd9d744595cc627cd960a3947f7d28831a502c6941d967e5ca"
            },
            "downloads": -1,
            "filename": "datasette_statistics-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5e7e0dec790cb9a8ef96d52f654afd19",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 2876,
            "upload_time": "2023-11-30T23:35:53",
            "upload_time_iso_8601": "2023-11-30T23:35:53.104520Z",
            "url": "https://files.pythonhosted.org/packages/01/0d/34986a50640d397e0951c8b49f89d81296665d487ecc1a4040280120cb41/datasette_statistics-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f817f9ca64f1b86305c35226c71eb43b373143f7a8020c2bb72384cea16f4760",
                "md5": "2e98af1006f1fbd489d86c41018692e2",
                "sha256": "4bc1f8ccbd0ff106527d3435dc1bf9daba7f952ba4022cfe21cdf4f8e7f010b7"
            },
            "downloads": -1,
            "filename": "datasette-statistics-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2e98af1006f1fbd489d86c41018692e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3075,
            "upload_time": "2023-11-30T23:35:54",
            "upload_time_iso_8601": "2023-11-30T23:35:54.649157Z",
            "url": "https://files.pythonhosted.org/packages/f8/17/f9ca64f1b86305c35226c71eb43b373143f7a8020c2bb72384cea16f4760/datasette-statistics-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-30 23:35:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "simonw",
    "github_project": "datasette-statistics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datasette-statistics"
}
        
Elapsed time: 0.15237s