kirajcg / pyscbwrapper Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for SCB's API
License: MIT License
Python wrapper for SCB's API
License: MIT License
src = 'http://api.scb.se/OV0104/v1/doris/en/ssd/START/FM/FM5001/FM5001A/FM5001SDDSPM'
scb = SCB('en')
scb.go_down('en', 'BE', 'BE0401')
How to request the file as a csv?
Hello Kira,
Thank you for creating this useful package. I wonder if it can be used with other databases related to SCB's, such as the Skogsstyrelsen's database (http://pxweb.skogsstyrelsen.se/pxweb/en/Skogsstyrelsens%20statistikdatabas/?rxid=03eb67a3-87d7-486d-acce-92fc8082735d) or the Natural Ressource Institute of Finland's (LUKE) database (https://statdb.luke.fi/PxWeb/pxweb/en/LUKE/LUKE__04%20Metsa__02%20Rakenne%20ja%20tuotanto__10%20Hakkuukertyma%20ja%20puuston%20poistuma/01c_Hakkuukertyma_koko_maa.px/table/tableViewLayout2/?rxid=dc711a9e-de6d-454b-82c2-74ff79a3a5e0), which seem to be built in the same way. They even refer to SCB's API documentation.
It would be wonderful, if I could somehow call the tables in these two databases with your package. Do you think it could be adapted easily within the package?
E.g vid försök att använda variabeln 'Sverige, 10 grupper' för att query'a slutnoden som nås via SCB('sv',"ME",'ME0201','ME0201B', 'Partisympati102') som keyword arg uppstår problemet att python ej godkänner detta som variabelnamn. Enda lösningen är därför att istället manuellt konstruera en dictionary, använda sig av kodnamnet Sverige10grupper och lägga in den i slutet av query listan. Jag föreslår därför en extra metod för att tillåta query via kodnamn
Med en setup.py slipper man själv installera requests.
När set_query körs för argumentet 'vart5:eår' får jag ett SyntaxError. Se nedan.
query = scb.set_query(region=['Stockholms län'],hustyp=['övriga hus'],hushållstyp1=['ensamboende män'],hushållstyp2=['ungdomshushåll, referenspers. 16-24 år'],lägenhetstyp=['1 eller flera rum med eller utan kokvrå, 1 kök'],upplåtelseform=['äger huset'],tabellinnehåll=['Bostadshushåll (FoB90)'],vart5:eår=['1990'])
^
SyntaxError: positional argument follows keyword argument
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.