From c5f413fbf45f1bf277ea22aa68b3801ebb6ce973 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Tue, 10 Dec 2024 23:50:21 +0000 Subject: [PATCH] fix: Fix series.isin using local path always --- bigframes/core/blocks.py | 6 ++---- bigframes/series.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bigframes/core/blocks.py b/bigframes/core/blocks.py index b548da2aa7..d1b2f91d60 100644 --- a/bigframes/core/blocks.py +++ b/bigframes/core/blocks.py @@ -2025,7 +2025,7 @@ def isin(self, other: Block): assert len(other.value_columns) == 1 unique_other_values = other.expr.select_columns( [other.value_columns[0]] - ).aggregate((), by_column_ids=(other.value_columns[0],)) + ).aggregate((), by_column_ids=(other.value_columns[0],), dropna=False) block = self # for each original column, join with other for i in range(len(self.value_columns)): @@ -2039,9 +2039,7 @@ def _isin_inner(self: Block, col: str, unique_values: core.ArrayValue) -> Block: expr, (l_map, r_map) = self._expr.relational_join( unique_values, ((col, unique_values.column_ids[0]),), type="left" ) - expr, matches = expr.project_to_id( - ops.eq_op.as_expr(ex.const(True), r_map[const]) - ) + expr, matches = expr.project_to_id(ops.notnull_op.as_expr(r_map[const])) new_index_cols = tuple(l_map[idx_col] for idx_col in self.index_columns) new_value_cols = tuple( diff --git a/bigframes/series.py b/bigframes/series.py index af09866bfe..842962f78a 100644 --- a/bigframes/series.py +++ b/bigframes/series.py @@ -719,7 +719,7 @@ def nsmallest(self, n: int = 5, keep: str = "first") -> Series: def isin(self, values) -> "Series" | None: if isinstance(values, (Series,)): - self._block.isin(values._block) + return Series(self._block.isin(values._block)) if not _is_list_like(values): raise TypeError( "only list-like objects are allowed to be passed to "