pyqog

A Python client for downloading, caching, and exploring
Quality of Government (QoG) Institute datasets.

pip install pyqog
📚 About this package

pyqog was developed as a teaching tool for classroom exercises in Data Science courses taught by Professor Danny de Castro at IDP – Instituto Brasileiro de Ensino, Desenvolvimento e Pesquisa (Brazil).

This package facilitates access to Quality of Government Institute data for educational and academic research purposes. For official data and authoritative information, please access the QoG Institute website directly:

🔗 https://www.gu.se/en/quality-government

Found a bug or have suggestions? Contact: danny.soares@idp.edu.br

What is QoG?

The Quality of Government (QoG) Institute at the University of Gothenburg, Sweden, produces some of the most comprehensive comparative datasets in political science and public administration. Their data covers governance, corruption, social policy, environmental indicators, and much more for virtually every country in the world.

QoG datasets compile data from hundreds of sources (World Bank, UN, V-Dem, Transparency International, and many others) into easy-to-use, well-documented datasets. They are widely used by researchers, students, and policymakers around the world.

Visit the QoG Institute website →

QoG Datasets
  • Basic — Key governance indicators
  • Standard — Comprehensive dataset (~2,000 variables)
  • OECD — OECD member countries
  • Environmental — Environmental indicators
  • Social Policy — Social policy data

What is pyqog?

pyqog is a lightweight Python package that makes it easy to download, cache, and work with QoG datasets directly from Python. It is inspired by the R package rqog and provides a simple, Pythonic interface for accessing the same data.

📥
Easy Download

Download any QoG dataset with a single function call. CSV format only — clean and portable.

💾
Smart Cache

Automatic local caching so you download once and work offline. Force re-download when you need fresh data.

📈
pandas Integration

Returns pandas DataFrames ready for analysis. Filter, merge, plot — all with familiar tools.

Quick Start

1. Install
pip install pyqog
2. Download and explore data
import pyqog

# Download the basic time-series dataset (latest version)
df = pyqog.read_qog()

# Download standard cross-sectional data
df_std = pyqog.read_qog(which_data="standard", data_type="cross-sectional")

# Download an older version (2020)
df_old = pyqog.read_qog(which_data="basic", year=2020)

# List available datasets
pyqog.list_datasets()

# Search for variables containing "corrupt"
cols = pyqog.search_variables(df, "corrupt")
print(cols)
3. Explore further

Check the Tutorial for detailed examples, the API Reference for full documentation, and the Datasets page for an overview of all available data.

Documentation

Citation

When using QoG data, please cite:

Teorell, Jan, et al. 2026. The Quality of Government Standard Dataset, version Jan26. University of Gothenburg: The Quality of Government Institute, https://www.gu.se/en/quality-government