Last active
January 13, 2022 02:29
-
-
Save lifeparticle/1f60ce2972e4ff4157140c3f030abe52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dash | |
from dash import dcc | |
from dash import html | |
import plotly.express as px | |
import pandas as pd | |
app = dash.Dash(__name__) | |
server = app.server | |
df = pd.read_csv("netflix_titles.csv") | |
df.drop_duplicates(inplace=True) | |
pie_fig = px.pie( | |
data_frame=df, | |
names='type', | |
hole=0.8, | |
title='TV Show vs. Movie') | |
bar_fig = px.bar( | |
data_frame=df.groupby(["type"], as_index=False).agg(count=pd.NamedAgg(column="type", aggfunc="count")), | |
x='type', | |
y='count', | |
color='type', | |
title='TV Show vs. Movie') | |
app.layout = html.Div(children=[ | |
html.H1(children='Visualizing Netflix Data With Python'), | |
html.Div(children=''' | |
Using Pandas, Plotly Express, and Dash. | |
'''), | |
html.Div([ | |
dcc.Graph( | |
id='graph1', | |
figure=pie_fig | |
), | |
]), | |
html.Div([ | |
dcc.Graph( | |
id='graph2', | |
figure=bar_fig | |
), | |
]), | |
]) | |
if __name__ == '__main__': | |
app.run_server(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment