Skip to main content

Easy, model based data wrangling.

Project description

wrangle_pypes

Easy, model based data wrangling.

Origin

This project came about thanks to having implemented this concept in a prior project (dfb_predict) and wanting to reuse it. In said previous project it came about, because we wanted to play around with data-oriented design and figured that if we break up the transformations required during data-wrangling/munging into a simple "AST" where each node represents a single transformation. And to further the idea we to some inspiration from one of the Unix philosophy core tenants, i.e. a single transformation should do one simple thing only, and allow for composition to implement more complex behavior.

Example

from dataclasses import dataclass
import json

from wrangle_pypes import Pipeline
from wrangle_pypes.transformations import Get, Create, Cast

@dataclass
class Point:
    x: int
    y: int


@dataclass
class Square:
    A: Point
    B: Point


pipeline = Pipline({
    Square: {
        "A": Get("A") | Create(Point),
        "A": Get("B") | Create(Point),
    },
    Point: {
        "x": Get("x") | Cast(int),
        "y": Get("y") | Cast(int),
    }
})

data = """
[
    {
        "A": {"x": 0, "y", 0},
        "B": {"x": 1, "y", 1},
    }, {
        "A": {"x": 10, "y", 10},
        "B": {"x": 11, "y", 11},
    }
]
"""

squares = list(pipeline.create_multiple(json.loads(data)))

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

wrangle_pypes-0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

wrangle_pypes-0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file wrangle_pypes-0.1.tar.gz.

File metadata

  • Download URL: wrangle_pypes-0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for wrangle_pypes-0.1.tar.gz
Algorithm Hash digest
SHA256 7ecb8bea5216399b434f714caaeacf64f530f43282c59f297b49227dd02c4247
MD5 e3d2b6125e7eaf2e43ced536a52149a5
BLAKE2b-256 0050a0e0478ae8b61fb160a3bd76c6b93ec8debcfa0a2f881c3ac720d3c58389

See more details on using hashes here.

File details

Details for the file wrangle_pypes-0.1-py3-none-any.whl.

File metadata

  • Download URL: wrangle_pypes-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for wrangle_pypes-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c55841deb7a39b578b1d2e5a0001c51be001821f6c2488ce3779a10c583b4f2
MD5 3cdbc3661c5bf77fa7f2af370357dc02
BLAKE2b-256 13a608f961b4f28ba00eab5c60214a6224fe3b49f22eeb64eadff821bd24a3a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page