Skip to main content

This package help you to easily reduce the data input.

Project description

Info:DataReducer is an python tool for easily handling data.
Repository:https://github.com/shinrel22/data_reducer
Author: Tri Nguyen (https://github.com/shinrel22)
Maintainer:Tri Nguyen (https://github.com/shinrel22)

Installation

pipenv install python-data-reducer

Examples

Some simple examples of what DataReducer can do:

from data_reducer import DataReducer

>>> origin_data = {
    'id': '1',
    'avatar': {
        'creator': {
            'birthday': {'day': 22, 'month': 1, 'year': 1993},
            'email': 'example@gmail.com',
            'id': '1',
            'name': 'example'
        },
        'deleted': False,
        'id': '1',
        'path': 'abc',
        'types': ['a', 'b', 'c'],
        'url': 'url'
    },
    'translations': [
        {'content': '1', 'id': '1', 'locale': 'vi', 'name': 'A'},
        {'content': '2', 'id': '2', 'locale': 'en', 'name': 'B'}
    ]
}

>>> only_fields = [
    'id',
    'translations.id',
    'translations.locale',
    'translations.name',
    'translations.types',
    'avatar.url',
    'avatar.id',
    'avatar.creator.id',
    'avatar.creator.birthday.year',
]

>>> DataReducer(data=origin_data, include_fields=only_fields).run()

{
    'id': '1',
    'translations': [
        {'id': '1', 'locale': 'vi', 'name': 'A'},
        {'id': '2', 'locale': 'en', 'name': 'B'}
    ],
    'avatar': {
        'url': 'url',
        'id': '1',
        'creator': {
            'id': '1',
            'birthday': {'year': 1993}
        }
    }
}

Project details


Download files

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

Files for python-data-reducer, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size python_data_reducer-0.0.6-py2-none-any.whl (4.3 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size python_data_reducer-0.0.6.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page