Describe the bug
Hi,
I tried using the "New column" feature to populate custom data in the Dataframe component, but it seems to be giving me an error. When adding a new column and submitting, I get the following error :
ValueError: 3 columns passed, passed data had 4 columns
I tested this feature in the Colab example in the documentation and Gradio also flags an error when submitting.
Reproduction
import gradio as gr
def filter_records(records, gender):
return records[records["gender"] == gender]
iface = gr.Interface(
filter_records,
[
gr.inputs.Dataframe(
headers=["name", "age", "gender"],
datatype=["str", "number", "str"],
row_count=5,
),
gr.inputs.Dropdown(["M", "F", "O"]),
],
"dataframe",
description="Enter gender as 'M', 'F', or 'O' for other.",
)
iface.test_launch()
iface.launch()
Screenshot

Logs
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/gradio/routes.py", line 232, in predict
app.interface.process, raw_input
File "/usr/local/lib/python3.7/dist-packages/starlette/concurrency.py", line 39, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/usr/local/lib/python3.7/dist-packages/anyio/to_thread.py", line 29, in run_sync
limiter=limiter)
File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 754, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.7/dist-packages/gradio/interface.py", line 561, in process
for i, input_component in enumerate(self.input_components)
File "/usr/local/lib/python3.7/dist-packages/gradio/interface.py", line 561, in <listcomp>
for i, input_component in enumerate(self.input_components)
File "/usr/local/lib/python3.7/dist-packages/gradio/inputs.py", line 1470, in preprocess
return pd.DataFrame(x, columns=self.headers)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py", line 700, in __init__
dtype,
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py", line 483, in nested_data_to_arrays
arrays, columns = to_arrays(data, columns, dtype=dtype)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py", line 807, in to_arrays
content, columns = _finalize_columns_and_data(arr, columns, dtype)
File "/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py", line 909, in _finalize_columns_and_data
raise ValueError(err) from err
ValueError: 3 columns passed, passed data had 4 columns
System Info
Gradio version : 2.8.1
OS : macOS Monterey 12.2.1
Browser : Google Chrome Version 98.0.4758.109
Severity
blocker
Describe the bug
Hi,
I tried using the "New column" feature to populate custom data in the Dataframe component, but it seems to be giving me an error. When adding a new column and submitting, I get the following error :
ValueError: 3 columns passed, passed data had 4 columnsI tested this feature in the Colab example in the documentation and Gradio also flags an error when submitting.
Reproduction
Screenshot
Logs
System Info
Severity
blocker