Skip to content

Chaining base operations via pipe? #147

Answered by pwwang
GG-Delta asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Gernot,

It's all about Verb vs Function, which are registered by register_verb() and register_func() from pipda.

You can simply check whether a function is registered as a Verb or Function by:

>>> from datar import base
>>> from pipda import Function, Verb
>>> base.any_na
<datar.core.factory.DatarAggFunction object at 0x7f730eff25b0>
>>> from pipda import Function
>>> isinstance(base.any_na, Function)
True
>>> base.dim
<pipda.verb.Verb object at 0x7f730ef78b50>
>>> isinstance(base.dim, Verb)
True

A verb is a function that is able to accept the arguments except the first, which is the data, and wait for it to be piped in. For example, df >> base.dim(). However, Function just literally a…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@GG-Delta
Comment options

@pwwang
Comment options

@GG-Delta
Comment options

@GitHunter0
Comment options

Answer selected by GG-Delta
Comment options

You must be logged in to vote
1 reply
@GG-Delta
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #146 on September 21, 2022 15:07.