Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: fix nullable max_rows, max_columns (#608)

Myles Scolnicke1648f761be5
diff --git a/marimo/_output/formatters/leafmap_formatters.py b/marimo/_output/formatters/leafmap_formatters.py
index 135554f3af..98bd02c128 100644
--- a/marimo/_output/formatters/leafmap_formatters.py
+++ b/marimo/_output/formatters/leafmap_formatters.py
@@ -17,7 +17,7 @@ class LeafmapFormatter(FormatterFactory):
from marimo._output import formatting
@formatting.formatter(leafmap.Map)
- def _show_dataframe(lmap: leafmap.Map) -> tuple[str, str]:
+ def _show_map(lmap: leafmap.Map) -> tuple[str, str]:
# 540px is the pixel height that makes the map fit in the
# notebook without scrolling
height = lmap.layout.height or "540px"
diff --git a/marimo/_output/formatters/pandas_formatters.py b/marimo/_output/formatters/pandas_formatters.py
index a9e9ebc8c1..2c31975e86 100644
--- a/marimo/_output/formatters/pandas_formatters.py
+++ b/marimo/_output/formatters/pandas_formatters.py
@@ -26,7 +26,16 @@ class PandasFormatter(FormatterFactory):
max_rows = pd.get_option("display.max_rows")
max_columns = pd.get_option("display.max_columns")
show_dimensions_option = pd.get_option("display.show_dimensions")
+
if show_dimensions_option == "truncate":
+ # Handle None for max_rows
+ if max_rows is None:
+ max_rows = len(df.index)
+
+ # Handle None for max_columns
+ if max_columns is None:
+ max_columns = len(df.columns)
+
show_dimensions = (
len(df.index) > max_rows or len(df.columns) > max_columns
)