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 wherekeyword
is a stringindicating the keyword of
func
that 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
func
to the arguments.
- Raises:
-
When using
self
with a specifickeyword
if thekeyword
alsoappears on in the
kwargs
.
NotesUse
.pipe
when 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
func
takes its data asarg2
:>>> (df.pipe(h) >>> .pipe(g, arg1=a) >>> .pipe((func, 'arg2'), arg1=a, arg3=c) >>> )