Skip to content

Commit

Permalink
Fix gradio/components/dataframe.py not to import pandas.io (#7840)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
whitphx and gradio-pr-bot committed Mar 27, 2024
1 parent 75a2bf7 commit ecf5c52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/solid-cars-spend.md
@@ -0,0 +1,5 @@
---
"gradio": patch
---

feat:Fix gradio/components/dataframe.py not to import `pandas.io`
4 changes: 3 additions & 1 deletion gradio/components/dataframe.py
Expand Up @@ -19,14 +19,14 @@
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
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():
Expand Down Expand Up @@ -236,6 +236,8 @@ def postprocess(
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):
Expand Down

0 comments on commit ecf5c52

Please sign in to comment.