mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-11 11:19:58 +08:00
Fixes issue with datatype setting in gr.Dataframe. Setting no longer dependent on col_count (#7286)
* fixed * add changeset * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
a5feb1c8cb
commit
0d36ac05aa
5
.changeset/funny-experts-wave.md
Normal file
5
.changeset/funny-experts-wave.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fixes issue with datatype setting in gr.Dataframe. Setting no longer dependent on col_count
|
@ -133,9 +133,7 @@ class Dataframe(Component):
|
||||
if headers is not None
|
||||
else [str(i) for i in (range(1, self.col_count[0] + 1))]
|
||||
)
|
||||
self.datatype = (
|
||||
datatype if isinstance(datatype, list) else [datatype] * self.col_count[0]
|
||||
)
|
||||
self.datatype = datatype
|
||||
valid_types = ["pandas", "numpy", "array", "polars"]
|
||||
if type not in valid_types:
|
||||
raise ValueError(
|
||||
|
@ -1112,7 +1112,7 @@ class TestDataframe:
|
||||
"headers": ["Name", "Age", "Member"],
|
||||
"row_count": (1, "dynamic"),
|
||||
"col_count": (3, "dynamic"),
|
||||
"datatype": ["str", "str", "str"],
|
||||
"datatype": "str",
|
||||
"type": "pandas",
|
||||
"label": "Dataframe Input",
|
||||
"show_label": True,
|
||||
@ -1155,7 +1155,7 @@ class TestDataframe:
|
||||
"headers": ["1", "2", "3"],
|
||||
"row_count": (1, "dynamic"),
|
||||
"col_count": (3, "dynamic"),
|
||||
"datatype": ["str", "str", "str"],
|
||||
"datatype": "str",
|
||||
"type": "pandas",
|
||||
"label": None,
|
||||
"show_label": True,
|
||||
|
Loading…
Reference in New Issue
Block a user