A scraper of statistical data from viltolyckor.se, built on top of Statscraper.
Project description
This is a scraper for statistical data from the (https://www.viltolycka.se/statistik/viltolyckor-for-respektive-viltslag/)[viltolycka.se] built on top of the `Statscraper package <https://github.com/jplusplus/statscraper>`.
The scraper is limited to the data avialble through https://www.viltolycka.se/statistik/viltolyckor-for-respektive-viltslag/
Install
-------
.. code:: bash
$ pip install viltolyckor_scraper
Example usage
-------------
.. code:: python
from viltolyckor import ViltolyckorScraper
# Init scraper
scraper = ViltolyckorScraper()
# List all available datasets
datasets = scraper.items
# [<ViltolyckorDataset: viltolyckor per viltslag>]
# Select a dataset
dataset = scraper.items["viltolyckor per viltslag"]
# List all available dimensions
datasets = verksamhetsform.dimensions
# [<Dimension: region>, <Dimension: year>, <Dimension: month>, <Dimension: viltslag>]
# Make a query
res = dataset.fetch() # Get latest available data for whole country by default
# Analyze the results with Pandas
df = res.pandas
# Make a more specific query
# Get data for a given period
res = dataset.fetch({"period": "2015"})
# Or from a specific region (all years)
res = ds.fetch({"region": u"Stockholms län", "year": "*"})
Develop
------
Set up:
.. code:: bash
$ pip install -r requirements.txt
Run tests:
.. code:: bash
$ make tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for viltolyckor_scraper-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 164bfcab96d0f982af45af47bdc2f3a00c45da4ae08a1fb0d0a9cb3ae4bdaf32 |
|
MD5 | 364f8a06da24aca57aca9564dce97681 |
|
BLAKE2b-256 | 35b44a452185c4114a31bae6eb9a7ddea413cdb1ebce45b25cb3a3cc053b919e |