Timestream.pipe
- Timestream.pipe(func, *args, **kwargs)
-
Apply chainable functions that produce Timestreams.
- Parameters:
-
func (Union[Callable[, Timestream], Tuple[Callable[, Timestream], str]])
Function to apply to this Timestream.
Alternatively a
(func, keyword)tuple wherekeywordis a stringindicating the keyword of
functhat expects the Timestream.*args (Arg, default:
())Positional arguments passed into
func.****kwargs** (Arg, default:
{})A dictionary of keyword arguments passed into
func.
- Returns:
-
The result of applying
functo the arguments.
- Raises:
-
When using
selfwith a specifickeywordif thekeywordalsoappears on in the
kwargs.
NotesUse
.pipewhen chaining together functions that expect Timestreams.Instead of writing
>>> func(g(h(df), arg1=a), arg2=b, arg3=c)You can write
>>> (df.pipe(h) >>> .pipe(g, arg1=a) >>> .pipe(func, arg2=b, arg3=c) >>> )If you have a function that takes the data as (say) the second
argument, pass a tuple indicating which keyword expects the
data. For example, suppose
functakes its data asarg2:>>> (df.pipe(h) >>> .pipe(g, arg1=a) >>> .pipe((func, 'arg2'), arg1=a, arg3=c) >>> )