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)))
Metadata
Release files for wrangle-pypes 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wrangle_pypes-0.3.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wrangle_pypes-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / wrangle_pypes-0.3.tar.gz
| Download URL | wrangle_pypes-0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
624347838dd19bf2904440bc4bf36c41229aed519963ca0c2b6b14f6288a5c78
|
|
BLAKE2b-256 checksum How to use checksums |
a3c9c2a66e803f5d7e86dad77c409a4eb05f2111423d03c3d2c6ad3e384a306a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / wrangle_pypes-0.3-py3-none-any.whl
| Download URL | wrangle_pypes-0.3-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba1a7643a7436d6dc71a2216e7bb9a1f49a07520adf16162a8a6c9ddeb2609c4
|
|
BLAKE2b-256 checksum How to use checksums |
3ebe4e4339d857653425f678fb2b6723cd53922ce90cb1b8ee597315270de35f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|