Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
13.22k stars 688 forks source link

feat: streamlit add new component: filter renderer #415

Closed longxiaofei closed 9 months ago

longxiaofei commented 9 months ago
  1. use StreamlitRenderer(recommend)
import streamlit as st
from pygwalker.api.streamlit import StreamlitRenderer

@st.cache_resource
def get_pyg_renderer() -> "StreamlitRenderer":
    df = pd.read_csv("xxxx")
    # When you need to publish your application, you need set `debug=False`,prevent other users to write your config file.
    return StreamlitRenderer(df, spec="xxx")

renderer = get_pyg_renderer()

renderer.render_filter_renderer()
  1. use get_streamlit_html
from streamlit.components.v1 import html
from pygwalker.api.streamlit import get_streamlit_html

html(get_streamlit_html(pd.DataFrame(), mode="filter_renderer"), height=1000)

image