From f9e99a28da56f68f51d709a34fc1ae94dd626748 Mon Sep 17 00:00:00 2001 From: Trevor Bergeron Date: Thu, 4 Apr 2024 00:41:19 +0000 Subject: [PATCH] add index uniqueness check --- bigframes/dataframe.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bigframes/dataframe.py b/bigframes/dataframe.py index b5ed65f5ed..6a472c2100 100644 --- a/bigframes/dataframe.py +++ b/bigframes/dataframe.py @@ -739,11 +739,12 @@ def _apply_series_binop_axis_1( how: str = "outer", reverse: bool = False, ) -> DataFrame: - # join columns schema - # indexers will be none for exact match + # Somewhat different alignment than df-df so separate codepath for now. if self.columns.equals(other.index): columns, lcol_indexer, rcol_indexer = self.columns, None, None else: + if not (self.columns.is_unique and other.index.is_unique): + raise ValueError("Cannot align non-unique indices") columns, lcol_indexer, rcol_indexer = self.columns.join( other.index, how=how, return_indexers=True )