From c9e8dc50e71943ab7b548f8aa31a11ded7538af7 Mon Sep 17 00:00:00 2001 From: bra-fsn Date: Wed, 23 Feb 2022 17:26:23 +0100 Subject: [PATCH] Support apply --- pandag/nodes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandag/nodes.py b/pandag/nodes.py index 3881993..f6f36dd 100644 --- a/pandag/nodes.py +++ b/pandag/nodes.py @@ -48,7 +48,10 @@ def __init__(self, _label=None, _id=None, expr=None, **kw): def update(self, df, loc): for k, v in self.kw.items(): - df.loc[loc, k] = df.eval(v) + if callable(v): + df.loc[loc, k] = df.apply(v, axis=1) + else: + df.loc[loc, k] = df.eval(v) if self.expr: # If there was an eval expression specified, update matching rows # with it.