ssb-datahub


Namessb-datahub JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryClient for the SSB datahub platform
upload_time2023-09-21 09:13:40
maintainer
docs_urlNone
authorYour Name
requires_python>=3.10,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <br />
<div align="center">
  <img src="images/logo.png" alt="Logo" width="80" height="80">
  <br />
  <h2 align="center">DATAHUB PYTHON CLIENT</h2>
  <br />
  <p align="center">

[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
[![PyPI](https://img.shields.io/pypi/v/ssb-datahub.svg)][pypi status]
[![Python Version](https://img.shields.io/pypi/pyversions/ssb-datahub)][pypi status]
[![License](https://img.shields.io/pypi/l/ssb-datahub)][license]
  </p>
  <p align="center">
    Client library for DataHub, a data platform developed at Statistics Norway
  </p>
  <br />
</div>

[license]: https://github.com/statisticsnorway/ssb-datahub/blob/main/LICENSE
[pypi status]: https://pypi.org/project/ssb-datahub/
[black]: https://github.com/psf/black

## Getting started

### Prerequisites

* [Install poetry](https://python-poetry.org/)

### Development environment

* Clone the repository
* Install the poetry environment

  ```sh
    poetry install
  ```

## Usage

```sh
pip install ssb-datahub
```

```python
from ssb_datahub import Client
dh = Client()

# Collect variables
kjonn = dh.get_variable("FREG", "BEFOLKNING_KJONN", "1.0.0")
fornavn = dh.get_variable("FREG", "BEFOLKNING_FORNAVN", "1.0.0")
fodt_aar = dh.get_variable("FREG", "BEFOLKNING_FODT_AAR", "1.0.0")

# Get the most popular names of men born in 1993
navnestatistikken_menn = (
    kjonn
        .left_join(fornavn, "IDENTIFIER")
        .filter("BEFOLKNING_KJONN", "1")
        .left_join(fodt_aar, "IDENTIFIER")
        .filter("BEFOLKNING_FODT_AAR", 1993)
        .count_values("BEFOLKNING_FORNAVN")
        .sort("BEFOLKNING_FORNAVN")
)
navnestatistikken_menn.sources
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ssb-datahub",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/89/9a/7e7a89ee9a9349e9352a96a4003cd2bf8e64d070accc9b17403a31060901/ssb_datahub-0.1.3.tar.gz",
    "platform": null,
    "description": "<br />\n<div align=\"center\">\n  <img src=\"images/logo.png\" alt=\"Logo\" width=\"80\" height=\"80\">\n  <br />\n  <h2 align=\"center\">DATAHUB PYTHON CLIENT</h2>\n  <br />\n  <p align=\"center\">\n\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]\n[![PyPI](https://img.shields.io/pypi/v/ssb-datahub.svg)][pypi status]\n[![Python Version](https://img.shields.io/pypi/pyversions/ssb-datahub)][pypi status]\n[![License](https://img.shields.io/pypi/l/ssb-datahub)][license]\n  </p>\n  <p align=\"center\">\n    Client library for DataHub, a data platform developed at Statistics Norway\n  </p>\n  <br />\n</div>\n\n[license]: https://github.com/statisticsnorway/ssb-datahub/blob/main/LICENSE\n[pypi status]: https://pypi.org/project/ssb-datahub/\n[black]: https://github.com/psf/black\n\n## Getting started\n\n### Prerequisites\n\n* [Install poetry](https://python-poetry.org/)\n\n### Development environment\n\n* Clone the repository\n* Install the poetry environment\n\n  ```sh\n    poetry install\n  ```\n\n## Usage\n\n```sh\npip install ssb-datahub\n```\n\n```python\nfrom ssb_datahub import Client\ndh = Client()\n\n# Collect variables\nkjonn = dh.get_variable(\"FREG\", \"BEFOLKNING_KJONN\", \"1.0.0\")\nfornavn = dh.get_variable(\"FREG\", \"BEFOLKNING_FORNAVN\", \"1.0.0\")\nfodt_aar = dh.get_variable(\"FREG\", \"BEFOLKNING_FODT_AAR\", \"1.0.0\")\n\n# Get the most popular names of men born in 1993\nnavnestatistikken_menn = (\n    kjonn\n        .left_join(fornavn, \"IDENTIFIER\")\n        .filter(\"BEFOLKNING_KJONN\", \"1\")\n        .left_join(fodt_aar, \"IDENTIFIER\")\n        .filter(\"BEFOLKNING_FODT_AAR\", 1993)\n        .count_values(\"BEFOLKNING_FORNAVN\")\n        .sort(\"BEFOLKNING_FORNAVN\")\n)\nnavnestatistikken_menn.sources\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Client for the SSB datahub platform",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d77b4d16a12307414732cd6c98837007e6bd825405c1ae1acb31f78124ea673e",
                "md5": "7a4d4a0bf9f3551d9009557e7937bfd9",
                "sha256": "e8978b73417fb9ee75d4b6522ad6709aad487ee298aa945fb1efac75fe6b4189"
            },
            "downloads": -1,
            "filename": "ssb_datahub-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7a4d4a0bf9f3551d9009557e7937bfd9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 6564,
            "upload_time": "2023-09-21T09:13:39",
            "upload_time_iso_8601": "2023-09-21T09:13:39.547881Z",
            "url": "https://files.pythonhosted.org/packages/d7/7b/4d16a12307414732cd6c98837007e6bd825405c1ae1acb31f78124ea673e/ssb_datahub-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "899a7e7a89ee9a9349e9352a96a4003cd2bf8e64d070accc9b17403a31060901",
                "md5": "f076be922bd069205b1fe01a7b09d742",
                "sha256": "fc43665b73b328ab0813fb8df97acf8452575fcd6466601d906f9b5ed4c36219"
            },
            "downloads": -1,
            "filename": "ssb_datahub-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "f076be922bd069205b1fe01a7b09d742",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 4962,
            "upload_time": "2023-09-21T09:13:40",
            "upload_time_iso_8601": "2023-09-21T09:13:40.974304Z",
            "url": "https://files.pythonhosted.org/packages/89/9a/7e7a89ee9a9349e9352a96a4003cd2bf8e64d070accc9b17403a31060901/ssb_datahub-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-21 09:13:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ssb-datahub"
}
        
Elapsed time: 0.18833s