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.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6539dab436d7bc6dd6347c1fd69aa3fd3a0a0d23aab85d9bada17eb45e3b58e4 |
|
MD5 | 8ddbf23652195483ccf9e13f107774fc |
|
BLAKE2b-256 | f7d4b49096b569f92d4a8cf3d41af88f9f2b82706b7aab7734f746d8cc8231cd |
Hashes for viltolyckor_scraper-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e512e003d77b1cbcf1cd27371c19011aa70313f23e6a1a508dc190846eb15254 |
|
MD5 | e0d58ef717a7825fe42e5ba655c81d04 |
|
BLAKE2b-256 | eecd32ba25c09abf03b9b5b449d5792b5dac42264bd6f2da2e3ac7f66b69fc3b |