Overview ======== Click on a nut name for more details. **Decorators & Wrappers** : convert plain Python functions to nuts .. code:: Python >>> GreaterThan2 = nut_filter(lambda x: x > 2) >>> [1, 2, 3, 4] >> GreaterThan2() >> Collect() [3, 4] - :func:`nut_filter ` : wrapper to create nut filters. - :func:`nut_filterfalse ` : wrapper to create nut filters with inversed logic. - :func:`nut_function ` : wrapper for nut functions that operate on elements. - :func:`nut_processor ` : wrapper for nut processors that operate on iterables. - :func:`nut_sink ` : wrapper for nut sinks that aggregate data flows. - :func:`nut_source ` : wrapper for nut sources that generate data. **Printing** : printing of data .. code:: Python >>> [1, 2.3, 'text'] >> PrintType() >> Consume() 1 2.3 text - :class:`Print ` : print data to console. - :class:`PrintType ` : print data type - :class:`PrintColType ` : print column data, eg. tuples - :class:`PrintProgress ` : print progress on iterable. **Sources** : generate iterable data .. code:: Python >>> Range(5) >> Collect() [0, 1, 2, 3, 4] - :class:`Empty ` : empty source that does not generate anything. - :class:`Enumerate ` : generate infinite number of increasing integers. - :class:`Product ` : generate Cartesian product of iterables. - :class:`Range ` : generate range of integer numbers. - :class:`ReadCSV ` : read elements from file in CSV (or TSV) format. - :class:`Repeat ` : repeats a value n times or infinitely. **Sinks** : aggregate iterable data .. code:: Python >>> [1, 2, 3] >> Count() 3 - :class:`ArgMax ` : return index of largest element. - :class:`ArgMin ` : return index of smallest element. - :class:`Collect ` : collect elements in a container, e.g. list, set, dict. - :class:`Consume ` : consumes input and returns nothing. - :class:`Count ` : count number of elements. - :class:`CountValues ` : return dictionary with counts of the different values. - :class:`Head ` : collect first n elements in a container, e.g. list, set, dict. - :class:`Join ` : join elements in a string. - :class:`Max ` : return largest element. - :class:`Mean ` : compute mean value of elements. - :class:`MeanStd ` : compute mean and standard deviation. - :class:`Min ` : return smallest element. - :class:`Next ` : get next element. - :class:`Nth ` : get n-th element. - :class:`Reduce ` : reduce inputs with a given function. - :class:`Sort ` : return sorted list of elements. - :class:`Sum ` : return sum of elements. - :class:`Tail ` : collect last n elements in a container, e.g. list, set, dict. - :class:`Unzip ` : reverses Zip() and unzips tuple elements. - :class:`WriteCSV ` : write elements to file in CSV (or TSV) format. **Functions** : operate on individual elements and return elements .. code:: Python >>> [1, 2, 3] >> Square() >> Collect() [1, 4, 9] - :class:`Counter ` : counts elements in an external variable - use for debugging only. - :class:`Format ` : format element as a string. - :class:`Get ` : extract slice from (indexable) element. - :class:`GetCols ` : extract columns from (indexable) element. - :class:`Identity ` : returns the unchanged element. - :class:`NOP ` : no operation. disable individual nuts temporarily - use for debugging only. - :class:`Sleep ` : pause processing thread for a given time. - :class:`Square ` : return square of element. **Processors** : operate on iterables and return iterables .. code:: Python >>> [1, 2, 3, 4] >> Take(2) >> Collect() [1, 2] - :class:`Append ` : append to the elements of the iterable. - :class:`Cache ` : caches elements on disk. - :class:`Chunk ` : split iterable in chunks of size n. - :class:`ChunkWhen ` : create new chunk whenever predicate function is true. - :class:`ChunkBy ` : create new chunk whenever function value changes. - :class:`Clone ` : clone elements in iterables n times. - :class:`Combine ` : combines elements in subsequences of length r. - :class:`Concat ` : concatenates iterables. - :class:`Cycle ` : cycle through elments of input iterable infinitely. - :class:`Dedupe ` : removes duplicates from iterable. - :class:`Drop ` : drops first n elements. - :class:`DropWhile ` : drops first elements while predicate function is true. - :class:`Filter ` : drops elements if predicate function is false. - :class:`FilterCol ` : extract given columns and drops elements if predicate function is false. - :class:`FilterFalse ` : drops elements if predicate function is true. - :class:`FlatMap ` : maps function on elements and flattens result. - :class:`Flatten ` : flattens iterables within the input iterable. - :class:`FlattenCol ` : extract given columns from (indexable) elements and flattens result. - :class:`GroupBy ` : groups elements based on grouping function. - :class:`GroupBySorted ` : groups presorted iterable of elements. - :class:`If ` : executes nut depending on condition. - :class:`Insert ` : insert into the elements of the iterable. - :class:`Interleave ` : interleaves elements of multiple iterables. - :class:`Map ` : maps function on elements. - :class:`MapCol ` : maps function on specific columns of (indexable) elements. - :class:`MapMulti ` : maps multiple functions on elements, resulting in multiple output iterators. - :class:`MapPar ` : map function (in concurrent threads) on elements. - :class:`Partition ` : split iterable into two partitions based on predicate function. - :class:`Permutate ` : return successive r length permutations of elements. - :class:`Pick ` : pick every n-th element or sample with given probability from iterable. - :class:`Prefetch ` : pre-fetch elements in separate thread. - :class:`Shuffle ` : shuffle elements (partially). - :class:`Slice ` : return slice of iterable. - :class:`Take ` : return first n elements. - :class:`TakeWhile ` : return elements while predicate function is true. - :class:`Tee ` : return n independent iterators over iterable. - :class:`Try ` : handle exceptions. - :class:`Window ` : return sliding window over elements of iterable. - :class:`Zip ` : zip elements from multiple iterables. - :class:`ZipWith ` : zips elements from multiple iterables with a given function.