Penguni commited on
Commit
4d9b242
·
verified ·
1 Parent(s): e3dfdb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -3,8 +3,8 @@ import pandas as pd
3
  import plotly.express as px
4
 
5
  # Load your dataframes
6
- df1= pd.read_csv('series_after_cleaning.csv')
7
- df2= pd.read_csv('movie_after_cleaning.csv')
8
 
9
  # Function to generate treemap
10
  def create_treemap(df, title):
@@ -14,11 +14,14 @@ def create_treemap(df, title):
14
  # Streamlit app
15
  st.title('Parental Guide Treemaps')
16
 
17
- # Add buttons to switch between dataframes
18
- option = st.selectbox('Select DataFrame', ['DataFrame 1', 'DataFrame 2'])
19
 
20
- # Display the corresponding treemap based on the selected dataframe
21
- if option == 'DataFrame 1':
22
- st.plotly_chart(create_treemap(df1, 'Parental Guide - DataFrame 1'))
23
- else:
24
- st.plotly_chart(create_treemap(df2, 'Parental Guide - DataFrame 2'))
 
 
 
 
3
  import plotly.express as px
4
 
5
  # Load your dataframes
6
+ df_tv_series= pd.read_csv('series_after_cleaning.csv')
7
+ df_movies= pd.read_csv('movie_after_cleaning.csv')
8
 
9
  # Function to generate treemap
10
  def create_treemap(df, title):
 
14
  # Streamlit app
15
  st.title('Parental Guide Treemaps')
16
 
17
+ # Split into two columns
18
+ col1, col2 = st.columns(2)
19
 
20
+ # Add buttons in each column
21
+ with col1:
22
+ if st.button('Movies'):
23
+ st.plotly_chart(create_treemap(df_movies, 'Parental Guide - Movies'))
24
+
25
+ with col2:
26
+ if st.button('TV Series'):
27
+ st.plotly_chart(create_treemap(df_tv_series, 'Parental Guide - TV Series'))