Streamlit – A perfect tool for data visualization


In Minimal lines of code you can visualize the data you have. Streamlit Python framework for data science and for big data visualization.

With few lines of code you can build an app with data,plots and maps instantly, which may save some work. Coupled with panda and numpy the performance goes beyond you expect.

Here is a sample code which generate sales/purchase history line chart


The streamlit app

First up all install streamlit

pip install streamlit
import streamlit as st
import pandas as pd
st.title('Sales/Purchase History')
st.text('This is a simple Streamlit app using Widgets') 
df=pd.DataFrame({'Purchase':[1200,1450,1100,12700,1340],'Sales':[12000,45000,1000,67000,3400]},index=['JAN','FEB','MAR','APR','MAY'] )
 
if st.checkbox(label='Show Frame'):
    st.write(df)
options =st.multiselect(label='Filter',options=df.columns)
 
st.line_chart(df[options])

Running

Running the streamlit app have little different than other python scripts.

 streamlit run app.py

Use always run, on browser , which enables streamlit script will automatically refreshed while you made any change in data or script.

For more about the frame work and features I suggest the official documentation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.