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
$ pip install viltolyckor_scraper
Example usage
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:
$ pip install -r requirements.txt
Run tests:
$ make tests
Deployment
To deploy a new version to PyPi:
Update version in setup.py
Build: python3 setup.py sdist bdist_wheel
Upload: python3 -m twine upload dist/viltolyckor_scraper-X.Y.X*
…assuming you have Twine installed (pip install twine) and configured.
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
Built Distribution
Hashes for viltolyckor_scraper-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc7ee2ef4c7407406567347e390475f5c19d335d190baeca3856204315d2210e |
|
MD5 | d5e9de6426b32d8e1bf7bd70d45e88db |
|
BLAKE2b-256 | 192aeb368623483f30a73053139a1debd42794e594e14fd638bb73ffa87c24c4 |
Hashes for viltolyckor_scraper-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9a5ba272fba12478c207647233d5897d120626629d9d979fa3fd41f5805b2b |
|
MD5 | 403afbeaf4e47acc24a9c146bff1c46a |
|
BLAKE2b-256 | f4ee3a6767f5d6b229defe8bf9d3a4dd212661dc6c08c9f4a5d89c169f023183 |