Skip to content

Commit 9a19966

Browse files
committed
refactor(anywidget): optimize array flattening using pyarrow
1 parent fc122a5 commit 9a19966

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bigframes/display/_flatten.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ def _explode_array_columns(
422422

423423
new_columns[col_name] = final_values
424424

425-
result_df = pa.Table.from_pydict(new_columns).to_pandas()
425+
# Convert back to pandas; this is efficient since we have pyarrow arrays.
426+
result_table = pa.Table.from_pydict(new_columns)
427+
result_df = result_table.to_pandas(types_mapper=pd.ArrowDtype)
426428

427429
grouping_col_name = (
428430
"_original_index" if original_index_name is None else original_index_name

0 commit comments

Comments
 (0)