mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-30 11:00:11 +08:00
Fix gradio/components/dataframe.py not to import pandas.io
(#7840)
* Fix gradio/components/dataframe.py not to import `pandas.io` * add changeset * add changeset * Fix --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
75a2bf745d
commit
ecf5c524c2
5
.changeset/solid-cars-spend.md
Normal file
5
.changeset/solid-cars-spend.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
feat:Fix gradio/components/dataframe.py not to import `pandas.io`
|
@ -19,7 +19,6 @@ import numpy as np
|
||||
import pandas as pd
|
||||
import semantic_version
|
||||
from gradio_client.documentation import document
|
||||
from pandas.io.formats.style import Styler
|
||||
|
||||
from gradio.components import Component
|
||||
from gradio.data_classes import GradioModel
|
||||
@ -27,6 +26,7 @@ from gradio.events import Events
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import polars as pl # type: ignore
|
||||
from pandas.io.formats.style import Styler
|
||||
|
||||
|
||||
def _is_polars_available():
|
||||
@ -236,6 +236,8 @@ class Dataframe(Component):
|
||||
Returns:
|
||||
the uploaded spreadsheet data as an object with `headers` and `data` attributes
|
||||
"""
|
||||
from pandas.io.formats.style import Styler
|
||||
|
||||
if value is None:
|
||||
return self.postprocess(self.empty_input)
|
||||
if isinstance(value, dict):
|
||||
|
Loading…
Reference in New Issue
Block a user