Streamlit component that allows you to view a SandDance visualization of a dataframe.
Project description
streamlit-sanddance
Streamlit component that allows you to view a SandDance visualization of a dataframe.
Installation instructions
pip install streamlit-sanddance
Usage instructions
import streamlit as st
from streamlit_sanddance import sanddance
#sample random DataFrame
df = pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c'])
#make sure to use a key to prevent refreshing after an event
sdEvent = sanddance(df, key='sd1')
#if sdEvent is not None and contains a cubeClick >= 0, display the data row
if sdEvent is not None and 'cubeClick' in sdEvent and sdEvent['cubeClick'] is not None and sdEvent['cubeClick'] >= 0:
st.write(df.iloc[sdEvent['cubeClick']])
else:
st.write("No cubeClick event")
The return value is a dictionary of visual interaction events such as selections.
Dev Setup
- Ensure you have Python 3.6+.
- Create a new Python virtual environment for the Streamlit component:
$ cd streamlit
$ python3 -m venv venv # create venv
$ . venv/bin/activate # activate venv
$ pip install streamlit # install streamlit
- Initialize and run the component frontend:
$ cd streamlit/sanddance/frontend
$ npm install # Install npm dependencies
$ npm run start # Start the Webpack dev server
- From a separate terminal, run the Streamlit app:
$ cd streamlit
$ . venv/bin/activate # activate the venv you created earlier
$ pip install -e . # install streamlit-sanddance as editable package
$ streamlit run sanddance/example.py # run the example
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file streamlit-sanddance-0.0.7.tar.gz
.
File metadata
- Download URL: streamlit-sanddance-0.0.7.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e59ab2ada90700ca53b5cbefce3cb0f58a92f17f65a4fcb32366325a9483f83d |
|
MD5 | 9e4d6e46be414465c0e699871931c7e7 |
|
BLAKE2b-256 | 5393ba62e67f37b05ccaedca53fe531f501d7e808d77f477c5a9a1ce951212d3 |
File details
Details for the file streamlit_sanddance-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: streamlit_sanddance-0.0.7-py3-none-any.whl
- Upload date:
- Size: 10.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f008c2b17468e68fecdd042488c44cd9902c7e2934cce804379e5df3bfcc978a |
|
MD5 | 1860197ff657c53eeb1ed0f645401f46 |
|
BLAKE2b-256 | 2bd58376fa72d70450bc4f26652af7fec1207f8af96a43e660a9eb6e35661bba |