Skip to main content

Automatic hierarchical dataset interpolation and disaggregation

Project description

Data completion tool

A module to create a dataset with a parent/children hierarchy (H-MECE) and permorm a completion algorithm (parent/children disaggregation and time interpolation). It is used to transform a sparse dataset into a complete dataset ready to be used in a model.

There are some plot functions to visualize the results of the completion algorithm keeping a trace of the aggregations and interpolations made to facilitate any revue of the dataset.

[TOC]

📋 Requirements

  • Python 3.12 or higher

We recommend using one virtual environment per Python project to manage dependencies and maintain isolation. You can use a package manager like uv to help you with library dependencies and virtual environments.

📦 Install the data-completion-tool Package

Install the data-completion-tool package via pip:

pip install data-completion-tool

⚙️ Complete a dataset

Here is an example of a variable completion using a specified hierarchy:

import pandas as pd
from data_completion_tool import dct

# Create a Dataset instance
ds = dct.DataSet()

# Create a dimension dataframe to set the hierarchy
dimension = pd.DataFrame(
    {"name": ["location"], "value": ["france"], "parents_values": ["europe"]}
)
ds.set_dimension(dimension)

# Create a variable to complete
variable = pd.DataFrame(
        {
            "location": ["france", "france", "france", "europe", "europe", "europe"],
            "time": [1950, 1980, 2000, 1920, 1970, 2020],
            "value": [15, 40, 65, 10, 54, 76],
            "unit": ["random", "random", "random", "random", "random", "random"],
            "source_id": [1, 1, 1, 2, 2, 2],
        }
    )

# Create aspect properties
aspect_property = {"location": ["intensive"]}

# Complete the dataset
completed_dataset = ds.completion(variable, aspect_property)

📊 Visualize Datasets

You can visualise the completed datasets using special methods of the DataSet class:

ds.plot_with_source(completed_dataset, "variable", "lower right", same_figure=True)

🤝 Contributing

We welcome contributions to the Data providing project! To get started, please refer to the CONTRIBUTING file for detailed guidelines.

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

data_completion_tool-0.3.0.tar.gz (82.9 kB view details)

Uploaded Source

Built Distribution

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

data_completion_tool-0.3.0-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file data_completion_tool-0.3.0.tar.gz.

File metadata

File hashes

Hashes for data_completion_tool-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bbff84c76083b1903f6392c0a3cd7df2cfdf5067b4d228b821310bb43a2f2f7f
MD5 29001fd3c72a2449104b861eba57ad46
BLAKE2b-256 4345976e910d863fd112ab679646ebb91e14cf0ebff63730782015635a272640

See more details on using hashes here.

File details

Details for the file data_completion_tool-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for data_completion_tool-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1957d24a9209d204af3ebc657261f2fc11c67f7ce1a73b77ebce4a727ceb3aab
MD5 21edade19491dd212cfda9386057f688
BLAKE2b-256 c03c6f8909ca9c62562e781af3e2f0d4c19c529a4b97c16c83e79ea790da8710

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