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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
remove string charts for column header (#7039)
Shahmir Varqha77de0bfff2ff
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.pyindex 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 tablesexternal_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_rowsdiff --git a/tests/_plugins/ui/_impl/test_table.py b/tests/_plugins/ui/_impl/test_table.pyindex 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 valuesassert summaries.data is None- assert summaries.value_counts == {}def test_with_smaller_limit(self, table: ui.table) -> None:value_counts = table._get_value_counts(