Statistics Norway has got three external APIs. The most important one is the API:Create your own dataset or PxWebApi. Here are examples on how to use the APIs from Python.
The plan is to give all examples both in Norwegian and in English.
Examples using the API: Readymade datasets
- The Norsk / in English a very basic example on Index of retail sales towards .
- Norsk / English Import a readymade CSV dataset, Main Economic Forecasts, to Pandas. Shows basic plots using Pandas plot and Plotly Express.
Examples using http POST to query API:Create your own datasets PxWebApi
-
Norsk / English http POST example, combines two datasets from two Statbank tables using Pandas pivot, and plot them using Matplotlib.
-
Konkurs-datokonv / English shows the use of a general function for converting the time variable from category to date, and the difference of the two in two plots. The table used is on weekly bankruptcies.
-
nr-dateconv-nor / English shows posting of the same query for GDP changes to tables with different frequency, and the use of the function dateconv() which converts from Categories to dateformat and set a Pandas PeriodIndex.
-
text-code / English shows how to get both text and code from JSON-stat. Example using HS-code from monthly Foreign trade by country.
-
Laks-no / English is a basic example on using http POST to query API:Create your own datasets or PxWebApi.
Examples on Statistics Norways Statistical Classifications and Codelists API
- Klasskommune examples on how to get classifications, versions, changes, correspondence tables and variants.
- KOSTRA arter og funksjoner hvordan hente og filtrere KOSTRA arter og funksjoner med definisjoner via Klass API (KOSTRA - Municipality-State-Reporting)
Using R? Try our R-package PxWebApiData