Skip to content

When using a bool column gr.Datafame the dtype of the pandas dataframe changes from bool to object #11492

@janosch6

Description

@janosch6

Describe the bug

  1. I use a gr.Dataframe with one column configured with the datatype bool to display checkboxes.
  2. I toggle one checkbox
  3. The pandas dataframe retuned from the input-event contains at the toggled cell a lower-case written boolean value (true | false) insted of the correct written value in Python (True | False). Further the dtype of the colum of the pandas dataframe changes from bool to object

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def input_received(df_input):
    print("Input received:\n", df_input, df_input.dtypes)
    return str(df_input), str(df_input.dtypes)

df_data = pd.DataFrame({"A": [1, 2, 3, 4], "B": [True, False, True, False]})

with gr.Blocks() as demo:
    with gr.Row():
        dataframe = gr.Dataframe(headers=["A", "B"], value=df_data, interactive=True, show_row_numbers=True,
                                 static_columns=[0], datatype=["number", "bool"])
        with gr.Column():
            output_table = gr.Textbox(label="Table", value=str(df_data))
            output_dtypes = gr.Textbox(label="Table Data Types", value=str(df_data.dtypes))

        dataframe.input(input_received, inputs=dataframe, outputs=[output_table, output_dtypes])

demo.launch()

Screenshot

Initial State:
Image

After Toggle of 2th row:
Image

Logs

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.35.0
gradio_client version: 1.10.4

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 24.1.0
anyio: 4.9.0
audioop-lts is not installed.
fastapi: 0.115.14
ffmpy: 0.6.0
gradio-client: 1.10.4
groovy: 0.1.2
httpx: 0.28.1
huggingface-hub: 0.33.1
jinja2: 3.1.6
markupsafe: 3.0.2
numpy: 2.3.1
orjson: 3.10.18
packaging: 25.0
pandas: 2.3.0
pillow: 11.2.1
pydantic: 2.11.7
pydub: 0.25.1
python-multipart: 0.0.20
pyyaml: 6.0.2
ruff: 0.12.1
safehttpx: 0.1.6
semantic-version: 2.10.0
starlette: 0.46.2
tomlkit: 0.13.3
typer: 0.16.0
typing-extensions: 4.14.0
urllib3: 2.5.0
uvicorn: 0.35.0
mcp is not installed.
pydantic: 2.11.7
authlib is not installed.
itsdangerous is not installed.


gradio_client dependencies in your environment:

fsspec: 2025.5.1
httpx: 0.28.1
huggingface-hub: 0.33.1
packaging: 25.0
typing-extensions: 4.14.0
websockets: 15.0.1

Severity

Blocking usage of gradio

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions