Open machow opened 4 years ago
It seems this can already be achieved using a lambda
function:
(
fmri
>> filter(_.region == "parietal")
>> pipe(
lambda _: sns.lineplot(
x="timepoint", y="signal", hue="region", style="event", data=_
)
)
)
But it would be nice, of course, being able to use the magic _
directly.
This should be resolved using the call()
function. See https://siuba.org/guide/programming-pipes.html#call-external-functions . I think the last piece is to make this importable from siuba
rather than siuba.siu
An example came up on twitter where a user wants to pipe to seaborn. However, seaborn does not take data as its first argument.
Here is an example of seaborn from its docs:
Proposal. A new pipe function (for now), called
pipe_raw
that does not pass data as first arg, and expands uses of_
.alternatively, the pipe function could choose not to pass data as the first argument, when
_
is passed as an arg as inpipe_raw
above. However, I might lean toward keeping them separate for now, until it's more clear about what people would want from a single, comprehesive pipe function.