Implementation:Eventual Inc Daft DataFrame Show
| Knowledge Sources | |
|---|---|
| Domains | Data_Engineering, Data_Visualization |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Concrete tool for displaying a formatted preview of DataFrame contents to standard output provided by the Daft library.
Description
The show method on Daft's DataFrame class executes enough of the DataFrame to display the first n rows in a formatted table. It is environment-aware: in IPython/Jupyter notebooks, it uses IPython.display for rich rendering (including interactive HTML tables); in plain terminals, it falls back to print. The output includes column names, data types, and configurable formatting options such as column width, alignment, and box-drawing style.
Usage
Use df.show() for visual inspection of DataFrame contents during development and debugging. This is a method on DataFrame instances and requires no additional imports.
Code Reference
Source Location
- Repository: Daft
- File:
daft/dataframe/dataframe.py - Lines: L4284-4356
Signature
def show(
self,
n: int = 8,
format: PreviewFormat | None = None,
verbose: bool = False,
max_width: int = 30,
align: PreviewAlign = "left",
columns: list[PreviewColumn] | None = None,
) -> None
Import
import daft
# Method on DataFrame - no separate import needed
df.show()
df.show(n=20)
df.show(format="markdown")
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| n | int | No | Number of rows to show. Defaults to 8. |
| format | PreviewFormat or None | No | Box-drawing format (e.g., "fancy", "markdown"). Defaults to None (fancy table). |
| verbose | bool | No | Whether to print additional header information. Defaults to False. |
| max_width | int | No | Maximum character width per column. Defaults to 30. |
| align | PreviewAlign | No | Column alignment ("left", "right", "center"). Defaults to "left". |
| columns | list[PreviewColumn] or None | No | Per-column formatting overrides. Must match schema length if provided. |
Outputs
| Name | Type | Description |
|---|---|---|
| return | None | Prints formatted table to stdout (or IPython display). Returns None. |
Usage Examples
Basic Usage
import daft
df = daft.from_pydict({"x": [1, 2, 3], "y": ["a", "b", "c"]})
# Show first 8 rows (default)
df.show()
# Show first 2 rows
df.show(n=2)
Markdown Format
import daft
df = daft.from_pydict({"name": ["Alice", "Bob"], "score": [95, 87]})
# Output in markdown table format
df.show(format="markdown")
Custom Column Width
import daft
df = daft.from_pydict({"long_text": ["This is a very long string that might be truncated"]})
# Increase max column width to show more content
df.show(max_width=50)