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:
Yuichiro Tachibana (Tsuchiya) 2024-03-27 10:39:57 +09:00 committed by GitHub
parent 75a2bf745d
commit ecf5c524c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
feat:Fix gradio/components/dataframe.py not to import `pandas.io`

View File

@ -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):