コード例 #1
0
def Dist_harga_hasil(lokasi):
    df = data_clean()
    fig = px.histogram(df[df['neighbourhood_cleansed'] == lokasi],
                       x="price",
                       title='Histogram of price in ' + lokasi)
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #2
0
def Dist_harga():
    df = data_clean()
    fig = px.box(df,
                 x="neighbourhood_cleansed",
                 y="price",
                 title="Box Plot Price from Neighbourhood")
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #3
0
def Dist_harga3():
    df = data_clean()
    series_neigh_price = df.groupby(
        'neighbourhood_cleansed').mean()['price'].sort_values()
    fig = go.Figure([go.Bar(x=series_neigh_price.index, y=series_neigh_price)],
                    layout=go.Layout(title='Mean Price from Location'))
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #4
0
def Dist_harga2():
    df = data_clean()
    fig = go.Figure(
        data=[
            go.Pie(labels=df['neighbourhood_cleansed'].value_counts().index,
                   values=df['neighbourhood_cleansed'].value_counts(),
                   hole=.3)
        ],
        layout=go.Layout(
            title='persentasi neighbourhood cleansed',
            margin=go.Margin(
                l=0, r=200, b=100, t=100,
                pad=4)  # Margins - Left, Right, Top Bottom, Padding
        ))
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #5
0
def quadrant_plots():
    df = data_clean()
    df_group = df.QUADRANT.value_counts()
    fig = go.Figure([go.Bar(x=df_group.index, y=df_group.values)])
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #6
0
def ward_plots():
    df = data_clean()
    df_group2 = df.WARD.value_counts()
    fig = go.Figure([go.Bar(x=df_group2.index, y=df_group2.values)])
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json
コード例 #7
0
def Dist_harga1():
    df = data_clean()
    fig = px.histogram(df, x="price", title="Prices Distribution")
    fig_json = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    return fig_json