Skip to main content

A scraper of statistical data from built on top of Statscraper.

Project description

This is a scraper for statistical data from the statistcial databases built on top of the `Statscraper package <>`.

Very much alpha. Only tested on a selected topics.


pip install -r requirements.txt

Example usage

.. code:: python

from socialstyrelsen import SocialstyrelsenScraper

scraper = SocialstyrelsenScraper()
scraper.items # List databasese
# [<SocialstyrelsenDataset: abort (Aborter)>, <SocialstyrelsenDataset: amning (Amning)>...]

dataset = scraper.get("ekonomisktbistandmanad") # Get a specific (by id)

# Inpect dataset
print dataset.dimensions
# [<SocialstyrelsenDimension: MATT>, <SocialstyrelsenDimension: FOR>, <SocialstyrelsenDimension: LANGD>, <SocialstyrelsenDimension: OMR>, <SocialstyrelsenDimension: AGI>, <SocialstyrelsenDimension: AR>]

print dataset.dimensions["OMR"].allowed_values
# [<SocialstyrelsenDimensionValue: 0 (Hela Riket)>, <SocialstyrelsenDimensionValue: 1 (Stockholm)>, ...]

# Make a query, you have to explicitly define all dimension values you want
# to query.
res = dataset.fetch({
"TABELL": "1",
"OMR": ["01", "03"],
"MANAD": ["4", "5", "6"],
"AR": "2017",
"MATT": "1",

# Do something with the result
df = res.pandas


- Currently only properly tested on "ekonomiskt bistånd"
- Handle large queries.
- Handle dimension labels


Run tests:

make tests

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for socialstyrelsen_scraper, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size socialstyrelsen_scraper-0.0.2.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page