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.1.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.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for data_completion_tool-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ca426f37221a6a412de0a21c970f2f937dcc99e318fcbba37fa72c05eeb5c1fc
MD5 1ceedf294162145f07cd8548d824ef9d
BLAKE2b-256 b6ccfdd7f3bb013ed840ac360bbb1d9279a47fb60462de0f9ece853f7aa8ba30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for data_completion_tool-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ec85badf8f704439f36b93eeb9f139528db3e781c0421ba027788f80ea07ff2
MD5 007ade7c6507c6e36e12ad59d3eb2245
BLAKE2b-256 88b5f53e327819a5cb256a2f727312b9ac961700533e87787f63a0cef5cb3ef9

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