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.2.tar.gz (131.1 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.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: data_completion_tool-0.3.2.tar.gz
  • Upload date:
  • Size: 131.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for data_completion_tool-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ceea08b817b5eaa585d765c2581dffc656c5d566ae4e0ebfc8a12195d5727007
MD5 9ec61a63c9ee05f29c0e3ddc070fbd05
BLAKE2b-256 30ae881ff513199d1f93d0be4c4f0b9292821c3a560c2d2c94c3dc5def7c9911

See more details on using hashes here.

File details

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

File metadata

  • Download URL: data_completion_tool-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for data_completion_tool-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e08533e8d60a2b6f704643d22a60589b6eda110f85c6851178fb0e5fe4d68dc8
MD5 2074c2aa8f56d5050a434b062c2b0158
BLAKE2b-256 b12cf4eb61367900b37f7f081e7c998fcb43dada1240fa60c43bb9214d72bbf2

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