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 where keyword is a string

    indicating 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:

Timestream

The result of applying func to the arguments.

Raises:

ValueError

When using self with a specific keyword if the keyword also

appears on in the kwargs.

Notes

Use .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 as arg2:


>>> (df.pipe(h)

>>>    .pipe(g, arg1=a)

>>>    .pipe((func, 'arg2'), arg1=a, arg3=c)

>>>  )