Skip to content

Commit 8a376f5

Browse files
authored
Merge branch 'googleapis:main' into output_schema
2 parents f8de2ea + 9af7130 commit 8a376f5

File tree

11 files changed

+1597
-1086
lines changed

11 files changed

+1597
-1086
lines changed

bigframes/series.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,23 @@ def items(self):
14781478
for item in batch_df.squeeze(axis=1).items():
14791479
yield item
14801480

1481+
def _apply_callable(self, condition):
1482+
""" "Executes the possible callable condition as needed."""
1483+
if callable(condition):
1484+
# When it's a bigframes function.
1485+
if hasattr(condition, "bigframes_bigquery_function"):
1486+
return self.apply(condition)
1487+
# When it's a plain Python function.
1488+
else:
1489+
return self.apply(condition, by_row=False)
1490+
1491+
# When it's not a callable.
1492+
return condition
1493+
14811494
def where(self, cond, other=None):
1495+
cond = self._apply_callable(cond)
1496+
other = self._apply_callable(other)
1497+
14821498
value_id, cond_id, other_id, block = self._align3(cond, other)
14831499
block, result_id = block.project_expr(
14841500
ops.where_op.as_expr(value_id, cond_id, other_id)

0 commit comments

Comments
 (0)