a data science disciple, I used to work more in jupyter notebook, conducting EDA, designing and developing the model, and presenting the result on the notebook only. Sometimes, I tried to connect the Flask model and give it a working view for the audience, but connecting and developing a model with the front end seems time-consuming and tedious. Then I started exploring alternative and came to Streamlit, which is one of the great ways to share machine learning/data science models, analyses, and visualization without worrying much about the front end at all.

“Streamlit is the next step in ML and data science tools.” — Dominik Mortiz from Vega-Lite

Streamlit is an open-source Python library growing fast, making it easy to produce beautiful custom web-apps for data science and its subdomain. It is also an excellent tool that allows us to create highly interactive dashboards. The best thing about Streamlit is, it doesn’t require any knowledge of web development. If you know Python, you’re good to go!

I love streamlit because it brings some advanced models and visuals to a non-technical team. It lets you go from jupyter notebook to a sleek web app worthy of offering to an audience with minimum effort.

Here, we will learn to build self-exploratory visualization by working with Streamlit visual expression’s power, and I assume you have a good understanding of working with jupyter notebook.

_Here’s the full code for this tutorial __if you would like to follow along as you progress through the tutorial and _here’s the final product.

Requirements

  • Python 3.7 version or Plus
  • Streamlit 0.60 version or Plus
  • Pandas library
  • NumPy library
  • Seaborn library
  • Matplotlib library
  • Sublime Text editor for the Python script

Let’s Begin

Let’s first install Streamlit to our system through the terminal for Mac or command prompt for windows. Here I am using terminal.

$ pip install streamlit

Once finished, let’s run the Streamlit.

$ streamlit hello

Once you run the above command, the localhost server will open in your browser, automatically showing the home page of the Streamlit with few demo contents.

For this demo, I am using Palmer Penguins data. The data were collected and made available by Dr. Kristen Gorman and Palmer Station, Antarctica, LTER. Here we are saving the data as “Penguin data.csv”

Objectives

To create self-exploratory visualization on Palmer Penguins where user can

1. Explore daw data

2. See statistical description

3. Create own graphs (count plot, box plot, and displot as per user’s choice)

Once we download the data, let’s open a new file in any text editor( here I am using a sublime text editor) and name it app.py

Importing core packages and please note we are using ‘st’ as Streamlit command.

#python #data-visualization #data-science #data #streamlit

Build Your First Data Visualization Web App in Python Using Streamlit
3.10 GEEK