Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,15 +15,13 @@ df_tv_series['country'] = df_tv_series['country'].str.split(',')
|
|
15 |
def create_treemap(df, title):
|
16 |
fig = px.treemap(df, path=['parentalguide'], title=title)
|
17 |
return fig
|
18 |
-
def
|
19 |
-
# Explode the
|
20 |
-
df_exploded = df.explode('
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
title=title, color_continuous_scale=px.colors.sequential.Plasma)
|
26 |
-
fig.update_layout(showlegend=False)
|
27 |
return fig
|
28 |
def create_country_map(df, title):
|
29 |
country_counts = df['country'].value_counts().reset_index()
|
|
|
15 |
def create_treemap(df, title):
|
16 |
fig = px.treemap(df, path=['parentalguide'], title=title)
|
17 |
return fig
|
18 |
+
def create_genre_bar_chart(df, title):
|
19 |
+
# Explode the genre column to count each genre separately
|
20 |
+
df_exploded = df.explode('genre')
|
21 |
+
genre_counts = df_exploded['genre'].value_counts().reset_index()
|
22 |
+
genre_counts.columns = ['genre', 'count']
|
23 |
+
genre_counts = genre_counts.head(10) # Get top 10 genres
|
24 |
+
fig = px.bar(genre_counts, x='count', y='genre', orientation='h', title=title)
|
|
|
|
|
25 |
return fig
|
26 |
def create_country_map(df, title):
|
27 |
country_counts = df['country'].value_counts().reset_index()
|