@@ -1905,32 +1905,10 @@ def show_row_diff(
19051905 # Create a table with the joined keys and comparison columns
19061906 column_table = row_diff .joined_sample [keys + [source_column , target_column ]]
19071907
1908- def compare_cells (x : t .Any , y : t .Any ) -> bool :
1909- """Compare two cells and returns true if they're not equal, handling array objects."""
1910- if x is None or y is None :
1911- return x != y
1912-
1913- # Convert any array-like object to list for consistent comparison
1914- def to_list (val : t .Any ) -> t .Any :
1915- return (
1916- list (val )
1917- if isinstance (val , (pd .Series , np .ndarray , list , tuple , set ))
1918- else val
1919- )
1920-
1921- x = to_list (x )
1922- y = to_list (y )
1923- if isinstance (x , list ) and isinstance (y , list ):
1924- if len (x ) != len (y ):
1925- return True
1926- return any (a != b for a , b in zip (x , y ))
1927-
1928- return x != y
1929-
19301908 # Filter to retain non identical-valued rows
19311909 column_table = column_table [
19321910 column_table .apply (
1933- lambda row : compare_cells (row [source_column ], row [target_column ]),
1911+ lambda row : _compare_df_cells (row [source_column ], row [target_column ]),
19341912 axis = 1 ,
19351913 )
19361914 ]
@@ -2064,6 +2042,25 @@ def show_linter_violations(
20642042 self .log_warning (msg )
20652043
20662044
2045+ def _compare_df_cells (x : t .Any , y : t .Any ) -> bool :
2046+ """Helper function to compare two cells and returns true if they're not equal, handling array objects."""
2047+ if x is None or y is None :
2048+ return x != y
2049+
2050+ # Convert any array-like object to list for consistent comparison
2051+ def to_list (val : t .Any ) -> t .Any :
2052+ return list (val ) if isinstance (val , (pd .Series , np .ndarray , list , tuple , set )) else val
2053+
2054+ x = to_list (x )
2055+ y = to_list (y )
2056+ if isinstance (x , list ) and isinstance (y , list ):
2057+ if len (x ) != len (y ):
2058+ return True
2059+ return any (a != b for a , b in zip (x , y ))
2060+
2061+ return x != y
2062+
2063+
20672064def add_to_layout_widget (target_widget : LayoutWidget , * widgets : widgets .Widget ) -> LayoutWidget :
20682065 """Helper function to add a widget to a layout widget.
20692066
0 commit comments