Movie_dashboard / app.py
Penguni's picture
Update app.py
5a0a701 verified
raw
history blame
764 Bytes
import streamlit as st
import pandas as pd
import plotly.express as px
# Load your dataframes
df1= pd.read_csv('/content/series_after_cleaning.csv')
df2= pd.read_csv('/content/movie_after_cleaning.csv')
# Function to generate treemap
def create_treemap(df, title):
fig = px.treemap(df, path=['parentalguide'], title=title)
return fig
# Streamlit app
st.title('Parental Guide Treemaps')
# Add buttons to switch between dataframes
option = st.selectbox('Select DataFrame', ['DataFrame 1', 'DataFrame 2'])
# Display the corresponding treemap based on the selected dataframe
if option == 'DataFrame 1':
st.plotly_chart(create_treemap(df1, 'Parental Guide - DataFrame 1'))
else:
st.plotly_chart(create_treemap(df2, 'Parental Guide - DataFrame 2'))