Certificate/data science-IBM

dashboard

Olivia-BlackCherry 2023. 5. 11. 16:48

dashboard 

최적의 대시보드는 중요한 비지니스 질문에 대한 해답을 제시한다.

 

web-based dashboarding

ploty, panel, voila, streamlit, bokeh, matplotlib, Flask

 

1. ploty 

python library이다. 

40가지 unique한 chart가 있다. 

financial, maps, scientific, statistical, 3-dimensional style

# Import required packages
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
from dash.dependencies import Input, Output

# Add Dataframe

# Add a bar graph figure
# Add Dataframe
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "NYC", "MTL", "NYC"]
})
fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")

app = dash.Dash()
app.layout = html.Div(children=[
    html.H1(
        children='US Domestic Airline Flights Performance',
        style={
            'textAlign': 'center'
        }
    ),
   
    # Create dropdown
    html.Label('Report type'),
    dcc.Dropdown(options=[
            {'label': 'Yearly airline performance report', 'value':'A'},
            {'label': 'Yearly average flight delay statistics', 'value':'B'}
        ],
        value='A' # Providing a vallue to dropdown
    ),

    html.Label('Choose Year'),
        dcc.Dropdown(
        options=[
            {'label': str(year), 'value': year} for year in range(2005, 2020)
        ],
        placeholder="year"
    ),

    # Bar graph
    dcc.Graph(id='example-graph-2',figure=fig)
])

# Run Application
if __name__ == '__main__':
    app.run_server()


                            encoding = "ISO-8859-1",
                            dtype={'Div1Airport': str, 'Div1TailNum': str,
                                   'Div2Airport': str, 'Div2TailNum': str})

# Randomly sample 500 data points. Setting the random state to be 42 so that we get same result.
data = airline_data.sample(n=500, random_state=42)