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.

remove string charts for column header (#7039)

Shahmir Varqha77de0bfff2ff
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.py
index 4ed7056a2d..3e4c25f93e 100644
--- a/marimo/_plugins/ui/_impl/table.py
+++ b/marimo/_plugins/ui/_impl/table.py
@@ -980,14 +980,10 @@ class table(
# For now, we only compute value counts for categorical columns and small tables
external_type = external_type.lower()
- if (
- column_type == "string"
- and ("cat" in external_type or "enum" in external_type)
- or (
- column_type == "string"
- and total_rows <= CHART_MAX_ROWS_STRING_VALUE_COUNTS
- )
- ):
+ categorical_type = (
+ "cat" in external_type or "enum" in external_type
+ )
+ if column_type == "string" and categorical_type:
try:
val_counts = self._get_value_counts(
column, DEFAULT_VALUE_COUNTS_SIZE, total_rows
diff --git a/tests/_plugins/ui/_impl/test_table.py b/tests/_plugins/ui/_impl/test_table.py
index 91e3ea9bb5..b79a839cc9 100644
--- a/tests/_plugins/ui/_impl/test_table.py
+++ b/tests/_plugins/ui/_impl/test_table.py
@@ -1055,29 +1055,8 @@ class TestTableGetValueCounts:
)
table = ui.table(data)
summaries = table._get_column_summaries(ColumnSummariesArgs())
- assert summaries.value_counts == {
- "a": [
- ValueCount(
- value="unique values",
- count=CHART_MAX_ROWS_STRING_VALUE_COUNTS,
- )
- ]
- }
- assert summaries.data is None
-
- # If >20k rows, we should not get value_counts
- data = pd.DataFrame(
- {
- "a": [
- str(i)
- for i in range(CHART_MAX_ROWS_STRING_VALUE_COUNTS + 1)
- ]
- }
- )
- table = ui.table(data)
- summaries = table._get_column_summaries(ColumnSummariesArgs())
+ assert summaries.value_counts == {} # too many unique values
assert summaries.data is None
- assert summaries.value_counts == {}
def test_with_smaller_limit(self, table: ui.table) -> None:
value_counts = table._get_value_counts(