Skip to content

Commit

Permalink
removed extra pandas ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Red Giuliano committed Jan 9, 2025
1 parent 29dc2a7 commit 8d2e1f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions zt_backend/models/components/html.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from pydantic import Field
from typing import Union
from zt_backend.models.components.zt_component import ZTComponent
import pandas as pd

class HTML(ZTComponent):
"""This is a component is used to render arbitrary HTML"""
component: str = Field("zt-html", description="Vue component name")
v_html: str = Field("", description="HTML content of the component")

def pygwalker(id: str, df: pd.DataFrame, width: Union[int, str] = '100%', height: Union[int, str] = 920):
def pygwalker(id: str, df, width: Union[int, str] = '100%', height: Union[int, str] = 920):
"""Create a PyGWalker component from a pandas DataFrame"""
try:
import pandas as pd
Expand All @@ -18,4 +17,7 @@ def pygwalker(id: str, df: pd.DataFrame, width: Union[int, str] = '100%', height
"pygwalker or pandas is not installed. Please install with 'pip install pygwalkwer'."
) from e

if not isinstance(df, pd.DataFrame):
raise ValueError("Input must be a pandas DataFrame")

return HTML(id=id, v_html=pyg.to_html(df, width=width, height=height))

0 comments on commit 8d2e1f7

Please sign in to comment.