Closed mwouts closed 1 month ago
Thank you for making this pull request.
Did you know? You can try it on Binder: .
Also, the version of ITables developed in this PR can be installed with pip
:
pip install git+https://github.com/mwouts/itables.git@streamlit_component
(this requires nodejs
, see more at Developing ITables)
The latest version of itables
includes a streamlit component.
Install it with
pip install 'itables>=2.1.0'
To display a dataframe in a streamlit app, just type:
from itables.streamlit import interactive_table
interactive_table(df)
The interactive_table
function takes the same parameter as the show
function, up to certain limitations (in short: multi indexed columns will look a bit different, passing javascript code is not supported, pandas Style objects are not supported).
See the documentation at https://mwouts.github.io/itables/streamlit.html
A sample application is available at https://itables.streamlit.app/, see https://github.com/mwouts/demo_itables_in_streamlit for the source code.
The purpose of this PR is to provide a component that would display a DataFrame in a streamlit app.
The first version of the component could have the following limitations:
TODO:
to_html_datatable
that, given a dataframe and the usual arguments, returns the arguments to be passed toDataFrame
on the JS endcolumns
argument too (since we don't pass a HTML header for the table)dt_for_itables
, in order to provide the same datatables extensions in Streamlit as in Jupyter Notebooks.