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.

docs(table): fix single-column example in mo.ui.table docstring (#10075)

Oishe Farhan9d817eb8f8e6
diff --git a/marimo/_plugins/ui/_impl/table.py b/marimo/_plugins/ui/_impl/table.py
index 3459e70184..5271a527f2 100644
--- a/marimo/_plugins/ui/_impl/table.py
+++ b/marimo/_plugins/ui/_impl/table.py
@@ -352,7 +352,8 @@ class table(
1. a list of dicts, with one dict for each row, keyed by column names;
2. a list of values, representing a table with a single column;
- 3. a dataframe (e.g., Polars, Pandas, PyArrow, Ibis, DuckDB).
+ 3. a dict of lists, with one list for each column, keyed by column names;
+ 4. a dataframe (e.g., Polars, Pandas, PyArrow, Ibis, DuckDB).
Examples:
Create a table from a list of dicts, one for each row:
@@ -367,14 +368,23 @@ class table(
)
```
- Create a table from a single column of data:
+ Create a table from a list of values, as a single column:
```python
table = mo.ui.table(
- data=[
- {"first_name": "Michael", "last_name": "Scott"},
- {"first_name": "Dwight", "last_name": "Schrute"},
- ],
+ data=["Michael Scott", "Dwight Schrute"],
+ label="Users",
+ )
+ ```
+
+ Create a table from a dict of lists, one list per column:
+
+ ```python
+ table = mo.ui.table(
+ data={
+ "first_name": ["Michael", "Dwight"],
+ "last_name": ["Scott", "Schrute"],
+ },
label="Users",
)
```