Skip to main content

A Python wrapper for the Kolada API v3 (Swedish municipalities data)

Project description

Logo

KoladaPy

A comprehensive Python wrapper for the Kolada API v3, providing access to Swedish municipality data.

Python Versions License PyPI version

Note: This is an independent project and is not associated with Kolada.

About Kolada

Kolada is a database containing key performance indicators (KPIs) for Swedish municipalities and regions. This wrapper provides a simple interface to search for KPIs, download data, and work with the results in Pandas DataFrames.

Features

  • Search for KPIs with flexible filtering options
  • Access metadata for KPIs, municipalities, and organizational units
  • Download data with customizable parameters
  • Convert results to Pandas DataFrames for easy analysis
  • Automatic handling of pagination, validation and rate limits
  • Support for all API endpoints including data for different regions and organizational units

Requirements

  • Python 3.7 or higher
  • Dependencies:
    • requests>=2.25.0
    • pandas>=1.1.0
    • tqdm>=4.50.0
    • backoff>=1.10.0

Installation

pip install koladapy

Quick Start

Visit the tutorials folder for a basic usage guide.

from koladapy import KoladaAPI

# Initialize the client
kolada = KoladaAPI()

# Search for KPIs related to school
kpis = kolada.search_kpis("skola")
print(f"Found {len(kpis)} KPIs related to 'skola'")

# Get a specific KPI by ID
kpi = kolada.get_kpi("N15033")  # Pupils/teacher in primary school
print(f"KPI title: {kpi['title']}")

# Get the same data as a pandas DataFrame
df = kolada.get_data_as_dataframe(
    kpi_id="N15033", 
    municipality_id="0180", # Stockholm municipality
    years=[2020, 2021]
)
print(df.head())

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Resources

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

This project uses the following open source packages:

The full license texts are available in the LICENSES directory.

Project details


Download files

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

Source Distribution

koladapy-1.0.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

koladapy-1.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file koladapy-1.0.1.tar.gz.

File metadata

  • Download URL: koladapy-1.0.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for koladapy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fe2727f79358cf85feb3e504e56797642f8a7cbff8c024d5c5db4b03d4b363b1
MD5 bf1574cece2d453132ee328f4b07afb3
BLAKE2b-256 922d7c17c490d85b3a7af1a3c0cb590f282af863ea4eefc3b5d3ebf813e0e86d

See more details on using hashes here.

File details

Details for the file koladapy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: koladapy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for koladapy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fec31eaffdef813516e49bd5c22d12efbae179a5e5b62519dce818d18f97c26b
MD5 53a1aad916305d60cfcbf781fb4bda66
BLAKE2b-256 b24d75e1c85733ea3dc56b8d0f0bbbd9a7ef12f964df89f8d24d08d3f969819f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page