Skip to content

Commit 736929a

Browse files
committed
use test/plain for print(df)
1 parent 7e47895 commit 736929a

File tree

3 files changed

+101
-228
lines changed

3 files changed

+101
-228
lines changed

bigframes/dataframe.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,7 @@ def __repr__(self) -> str:
789789

790790
opts = bigframes.options.display
791791
max_results = opts.max_rows
792-
# anywdiget mode uses the same display logic as the "deferred" mode
793-
# for faster execution
794-
if opts.repr_mode in ("deferred", "anywidget"):
792+
if opts.repr_mode == "deferred":
795793
return formatter.repr_query_job(self._compute_dry_run())
796794

797795
# TODO(swast): pass max_columns and get the true column count back. Maybe
@@ -944,9 +942,9 @@ def _get_anywidget_bundle(self, include=None, exclude=None):
944942
widget_repr = dict(widget_repr_result)
945943

946944
# Use deferred repr for text/plain of anywidget display.
947-
# This avoids kicking off a query when the user is just
948-
# printing the last expression in a cell.
949-
widget_repr["text/plain"] = repr(df)
945+
# This ensures consistency with __repr__ and avoids unnecessary query execution
946+
# when the user is just printing the last expression in a cell.
947+
widget_repr["text/plain"] = formatter.repr_query_job(df._compute_dry_run())
950948
widget_repr["text/html"] = self._repr_html_fallback_()
951949
return widget_repr
952950

0 commit comments

Comments
 (0)