Introducing Gradio Clients


New to Gradio? Start here: Getting Started

See the Release History


import gradio as gr with gr.Blocks() as demo: gr.Dataframe(value= [ [0, 1, True], [1, 0, False] ] , interactive=True) demo.launch()


This component displays a table of value spreadsheet-like component. Can be used to display data as an output component, or as an input to collect data from the user.


As input component: Passes the uploaded spreadsheet data as a pandas.DataFrame, numpy.array, polars.DataFrame, or native 2D Python list[list] depending on type

Your function should accept one of these types:
def predict(
	value: pd.DataFrame | np.ndarray | pl.DataFrame | list[list]

As output component: Expects data any of these formats: pandas.DataFrame, pandas.Styler, numpy.array, polars.DataFrame, list[list], list, or a dict with keys 'data' (and optionally 'headers'), or str path to a csv, which is rendered as the spreadsheet.

Your function should return one of these types:
def predict(ยทยทยท) -> pd.DataFrame | Styler | np.ndarray | pl.DataFrame | list | list[list] | dict | str | None
	return value




Class Interface String Shortcut Initialization



Uses default values



Uses type="numpy"



Uses type="array"



Uses type="array", col_count=1


import gradio as gr def filter_records(records, gender): return records[records["gender"] == gender] demo = gr.Interface( filter_records, [ gr.Dataframe( headers=["name", "age", "gender"], datatype=["str", "number", "str"], row_count=5, col_count=(3, "fixed"), ), gr.Dropdown(["M", "F", "O"]), ], "dataframe", description="Enter gender as 'M', 'F', or 'O' for other.", ) if __name__ == "__main__": demo.launch()

Event Listeners


Event listeners allow you to respond to user interactions with the UI components you've defined in a Gradio Blocks app. When a user interacts with an element, such as changing a slider value or uploading an image, a function is called.

Supported Event Listeners

The Dataframe component supports the following event listeners. Each event listener takes the same parameters, which are listed in the Event Parameters table below.

Listener Description

Dataframe.change(fn, ยทยทยท)

Triggered when the value of the Dataframe changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See .input() for a listener that is only triggered by user input.

Dataframe.input(fn, ยทยทยท)

This listener is triggered when the user changes the value of the Dataframe., ยทยทยท)

Event listener for when the user selects or deselects the Dataframe. Uses event data gradio.SelectData to carry value referring to the label of the Dataframe, and selected to refer to state of the Dataframe. See EventData documentation on how to use this event data

Event Parameters