Penguni commited on
Commit
0488555
·
verified ·
1 Parent(s): dcbc569

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -10,6 +10,11 @@ df_movies= pd.read_csv('movie_after_cleaning.csv')
10
  def create_treemap(df, title):
11
  fig = px.treemap(df, path=['parentalguide'], title=title)
12
  return fig
 
 
 
 
 
13
 
14
  # Streamlit app
15
  st.title('Parental Guide Treemaps')
@@ -32,5 +37,8 @@ with col2:
32
  # Display the corresponding treemap in the center
33
  if selection == 'Movies':
34
  st.plotly_chart(create_treemap(df_movies, 'Parental Guide - Movies'), use_container_width=True)
 
35
  elif selection == 'TV Series':
36
- st.plotly_chart(create_treemap(df_tv_series, 'Parental Guide - TV Series'), use_container_width=True)
 
 
 
10
  def create_treemap(df, title):
11
  fig = px.treemap(df, path=['parentalguide'], title=title)
12
  return fig
13
+ def create_genre_bar_chart(df, title):
14
+ genre_counts = df['genre'].value_counts().reset_index()
15
+ genre_counts.columns = ['genre', 'count']
16
+ fig = px.bar(genre_counts, x='genre', y='count', title=title)
17
+ return fig
18
 
19
  # Streamlit app
20
  st.title('Parental Guide Treemaps')
 
37
  # Display the corresponding treemap in the center
38
  if selection == 'Movies':
39
  st.plotly_chart(create_treemap(df_movies, 'Parental Guide - Movies'), use_container_width=True)
40
+ st.plotly_chart(create_genre_bar_chart(df_movies, 'Top Genres - Movies'), use_container_width=True)
41
  elif selection == 'TV Series':
42
+ st.plotly_chart(create_treemap(df_tv_series, 'Parental Guide - TV Series'), use_container_width=True)
43
+ st.plotly_chart(create_genre_bar_chart(df_tv_series, 'Top Genres - TV Series'), use_container_width=True)
44
+