Let's now use Pandas to perform EDA in a Streamlit app. Particularly, we're going to create an app that will allow us to load in a CSV data and perform a quick EDA analysis of the data.
Here's an explanation of the code in a step-by-step manner:
- Import necessary libraries
- Display the title of the app
- Load and display a CSV file as DataFrame
- Create a conditional button that displays a DataFrame of a descriptive statistics analysis upon clicking on the
Show descriptive statistics analysis
button
import streamlit as st
import pandas as pd
st.title('🐼 Pandas - An EDA example')
df = pd.read_csv('https://raw.githubusercontent.com/dataprofessor/data/master/delaney_solubility_with_descriptors.csv')
st.write(df)
if st.button('Show descriptive statistics analysis'):
st.write(df.describe())
else:
st.info('👆 Click on the button ')
The above code gives us the following Streamlit app (GitHub repo | Demo app)
Now that you have this Pandas app completed, can you build upon this Streamlit app by adding input widgets that will allow users to select one of many EDA statistical analysis of their choice. After selection of the analysis option to perform, the app will conditionally display the corresponding output.
📣 Learn in Public:
Share your solution (the updated Streamlit app) on social media (Twitter and/or LinkedIn) and tag us (
@streamlit
).