> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
> Use this file to discover all available pages before exploring further.

# Dataframe

> Create spreadsheet-like data components in Gradio

The Dataframe component displays and edits tabular data in a spreadsheet format.

## Basic usage

```python theme={null}
import gradio as gr
import pandas as pd

def process_data(df):
    return df.describe()

gr.Interface(
    fn=process_data,
    inputs=gr.Dataframe(),
    outputs=gr.Dataframe()
).launch()
```

## Constructor

<ParamField path="value" type="pd.DataFrame | np.ndarray | list | dict | str | Callable | None" default="None">
  Default data. Accepts pandas DataFrame, numpy array, list of lists, dict, or CSV filepath
</ParamField>

<ParamField path="headers" type="list[str] | None" default="None">
  Column headers. If None, headers are inferred from data
</ParamField>

<ParamField path="row_count" type="int | None" default="None">
  Initial number of rows to display
</ParamField>

<ParamField path="column_count" type="int | None" default="None">
  Initial number of columns. Defaults based on data
</ParamField>

<ParamField path="datatype" type="str | Sequence[str]" default="'str'">
  Column datatypes. Can be:

  * Single string: `"str"`, `"number"`, `"bool"`, `"date"`, `"markdown"`
  * List per column: `["str", "number", "bool"]`
  * `"auto"` - Automatically infer types
</ParamField>

<ParamField path="type" type="Literal['pandas', 'numpy', 'array', 'polars']" default="'pandas'">
  Format passed to function:

  * `"pandas"` - pandas DataFrame
  * `"numpy"` - numpy array
  * `"array"` - Python list of lists
  * `"polars"` - Polars DataFrame
</ParamField>

<ParamField path="interactive" type="bool | None" default="None">
  Whether users can edit the dataframe
</ParamField>

<ParamField path="max_height" type="int | str" default="500">
  Maximum height with scrollbar if needed
</ParamField>

<ParamField path="wrap" type="bool" default="False">
  Whether text in cells should wrap
</ParamField>

<ParamField path="line_breaks" type="bool" default="True">
  Enable line breaks in markdown cells
</ParamField>

## Events

* **change** - Triggered when data changes
* **input** - Triggered on input
* **select** - Triggered when cell is selected
* **edit** - Triggered when cell is edited

## Examples

### With pandas

```python theme={null}
import gradio as gr
import pandas as pd

df = pd.DataFrame({
    "Name": ["Alice", "Bob"],
    "Age": [25, 30],
    "City": ["NYC", "LA"]
})

gr.Dataframe(value=df, interactive=True)
```

### With specific datatypes

```python theme={null}
import gradio as gr

gr.Dataframe(
    headers=["Name", "Score", "Passed"],
    datatype=["str", "number", "bool"],
    row_count=3
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.