mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
710 stars 53 forks source link

Provide a streamlit component for ITables #270

Closed mwouts closed 1 month ago

mwouts commented 1 month ago

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:

github-actions[bot] commented 1 month ago

Thank you for making this pull request.

Did you know? You can try it on Binder: Binder:lab.

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)

mwouts commented 1 month ago

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.