Skip to main content

Flatten complex data.

cherrypicker aims to make common ETL tasks (filtering data and restructuring it into flat tables) easier, by taking inspiration from jQuery and applying it in a Pythonic way to generic data objects.

pip install cherrypicker

cherrypicker provides a chainable filter and extraction interface to allow you to easily pick out objects from complex structures and place them in a flat table. It fills a similar role to jQuery in JavaScript, enabling you to navigate complex structures without the need for lots of complex nested for loops or list comprehensions.

Examples

>>> from cherrypicker import CherryPicker
>>> import json
>>> with open('climate.json', 'r') as fp:
...     data = json.load(fp)
>>> picker = CherryPicker(data)
>>> picker['id', 'city'].get()
[[1, 'Amsterdam'], [2, 'Athens'], [3, 'Atlanta GA'], ...]
>>> picker(city='B*')['info'](
...     population=lambda n: n > 2000000,
...     area=lambda a: a < 2000
... )['area', 'population'].get()
[[1568, 8300000], [891, 3700000], [203, 2800000]]

More complex filtering and flattening of nested structures is possible. Learn more in the documentation: https://cherrypicker.readthedocs.io.

Metadata

Release files for cherrypicker 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cherrypicker 0.4.0
File Size Uploaded
cherrypicker-0.4.0.tar.gz 221.6 kB Details

Release files / cherrypicker-0.4.0.tar.gz

Download URL cherrypicker-0.4.0.tar.gz
Size 221.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dac52a21eba5dcb2d568a1a787bc8e1d731f76104af1eb2bfca0c55a9b3abf26
BLAKE2b-256 checksum
How to use checksums
f2c637c2fa453de028a8df33e6ce6c55b42b3bbf1bc42e5fa7bdcfb63052063a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page