Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Easy, model based data wrangling.

Project description


Easy, model based data wrangling.


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.


from dataclasses import dataclass
import json

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

class Point:
    x: int
    y: int

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.

Files for wrangle-pypes, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size wrangle_pypes-0.3-py3-none-any.whl (5.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size wrangle_pypes-0.3.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page