A simple data-flow framework based on iterator chaining
Project description
nuts-flow is largely a thin wrapper around Python’s itertools that allows the chaining of iterators using the >> operator. This leads to more readable code that highlights the flow of data. The following example shows two implementations of a simple data processing pipeline; the first based on itertools and the second using nuts-flow:
>>> from itertools import islice, ifilter >>> list(islice(ifilter(lambda x: x > 5, xrange(10)), 3)) [6, 7, 8]>>> from nutsflow import Range, Filter, Take, Collect, _ >>> Range(10) >> Filter(_ > 5) >> Take(3) >> Collect() [6, 7, 8]
Both examples extract the first three numbers within range [0, 9] that are greater than five. However, the nuts-flow pipeline is easier to understand than the nested itertools code.
nuts-flow is the base for nuts-ml, which is described here .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nutsflow-1.0.13-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c027d3fe9004c74e76c6c867362f7db2187b806e08556fb35d95298036d2711 |
|
MD5 | a83d45dc2f563f8c4dc0cc2e7bf81f63 |
|
BLAKE2b-256 | 674a9ebdab41e6c298c438a31d682d104006879822fea6c16ba4bf232914aaa5 |