You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/authoring/tables.qmd
+25-13Lines changed: 25 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -279,36 +279,48 @@ kable(head(cars))
279
279
280
280
If your code cell produces multiple tables, you can also specify subcaptions and layout using cell options:
281
281
282
-
::: {.panel-tabset}
283
-
## R
282
+
::: {.panel-tabset group="language"}
283
+
284
+
## Python
284
285
285
-
```{.r}
286
+
````python
287
+
```{{python}}
286
288
#| label: tbl-example
287
289
#| tbl-cap: "Example"
288
290
#| tbl-subcap:
289
-
#| - "Cars"
290
-
#| - "Pressure"
291
+
#| - "MPG"
292
+
#| - "Taxis"
291
293
#| layout-ncol: 2
292
-
#| echo: fenced
293
294
294
-
library(knitr)
295
-
kable(head(cars))
296
-
kable(head(pressure))
295
+
import seaborn as sns
296
+
from IPython.display import Markdown, display
297
+
mpg = sns.load_dataset("mpg").head(10)
298
+
taxis = sns.load_dataset("taxis").head(10)
299
+
300
+
display(Markdown(mpg.to_markdown(index=False)))
301
+
display(Markdown(taxis.to_markdown(index=False)))
297
302
```
303
+
````
298
304
299
-
## Python
305
+
Note that we use the [`display()`](https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html#IPython.display.display) function imported from `IPython` so that we can render multiple outputs from a single cell (by default cells only output their last expression).
0 commit comments