コード例 #1
0
def update_new_tab(cleaned_data, activity):
    df_display = pd.read_json(cleaned_data, orient='split')
    if (len(df_display) == 0):
        return {
            'data': [
                go.Table(header=dict(values=['Message']),
                         cells=dict(values=[['No data']]))
            ]
        }
    df_display = df_display[[
        'Activity', 'Gender', 'Age cohorts', 'District', '0'
    ]]
    df_display = df_display[df_display['Activity'] == activity]
    df_display = df_display[['District', 'Gender', 'Age cohorts', '0']]
    df_display['Sum'] = df_display['0']
    df_display = df_display[['District', 'Gender', 'Age cohorts', 'Sum']]
    df_display = df_display.rename(index=str,
                                   columns={
                                       "Age cohorts": "Age Category",
                                       "Sum": "Total Actual"
                                   })
    vals = []
    for i in range(len(list(df_display))):
        vals.append(df_display.iloc[:, i])
    return {
        'data': [
            go.Table(header=dict(values=list(df_display.columns),
                                 font=dict(family='Roboto',
                                           size=16,
                                           color='#ffffff'),
                                 fill=dict(color='#ffffff')),
                     cells=dict(values=vals,
                                fill=dict(color='#ffffff'),
                                font=dict(family='Roboto',
                                          size=14,
                                          color='#333333'),
                                align=['left'] * 5))
        ]
    }
コード例 #2
0
def create_chart(sampleTimes, deviceStatus, filename=tableName):
    trace = go.Table(header=dict(values=['Time', 'Device Status']),
                     cells=dict(values=[sampleTimes, deviceStatus]))

    data = [trace]
    layout = go.Layout(title=filename)

    fig = go.Figure(data=data, layout=layout)
    plot_url = py.plot(fig,
                       filename=filename,
                       auto_open=False,
                       world_readable=True)
    return plot_url
コード例 #3
0
ファイル: 5.py プロジェクト: LuninaPolina/CompMethods
def table2(n):
    A1,B1,C1,G1,X1 = coeff(n)
    A2,B2,C2,G2,X2 = coeff2(n)
    S1,T1,Y1 = sweep(n,A1,B1,C1,G1)
    S2,T2,Y0 = sweep(n+1,A2,B2,C2,G2)
    Y3 = [(Y0[i]+Y0[i+1])/2 for i in range(n+1)]
    Y1 = runge(n,1,Y1)
    Y2 = runge(n,2,Y3)
    trace = go.Table(
        header=dict(values=['x','Y_ex','Y_ut(h)','Y_ut - Y_ex','Y_ut(h^2)','Y_ut - Y_ex']),
        cells=dict(values=[rnd(X1,2),Y_ex1,rnd(Y1,6),[round(abs(Y1[i]-Y_ex1[i]),6) for i in range(n+1)],rnd(Y2,5),[round(abs(Y2[i]-Y_ex1[i]),10) for i in range(n+1)]]))    
    data = [trace] 
    plotly.offline.plot(data)
コード例 #4
0
ファイル: views.py プロジェクト: arafatarshad/metamarker
 def descriptionTable(self, df):
     cell_column = self.descriptionTableValues(df)
     trace = go.Table(header=dict(values=cell_column[0],
                                  fill=dict(color='#C2D4FF'),
                                  font=dict(size=10),
                                  align="left"),
                      cells=dict(values=cell_column[1],
                                 fill=dict(color='#F5F8FF'),
                                 align="left"))
     data = [trace]
     layout = go.Layout(title="Observations about the dataset", height=750)
     figure = go.Figure(data=data, layout=layout)
     return opy.plot(figure, auto_open=False, output_type='div')
コード例 #5
0
def tabular(final):
    #La tabla es generada como un archivo en plot.ly en un respectivo usuario. En este ejemplo usamos el usuario y la llave
    #de Isabella, pero si se desea, se puede usar cualquier usuario en plot.ly cambiando la siguiente información:
    plotly.tools.set_credentials_file(username='******',
                                      api_key='rjQlbw3URviMOZxB5eGP')
    trace = go.Table(
        header=dict(values=['Monitor', 'Cálculo 1', 'Lógica', 'Pensamiento']),
        cells=dict(values=[['Pablo', 'Sergio', 'Laura'],
                           [final[0], final[3], final[6]],
                           [final[1], final[4], final[7]],
                           [final[2], final[5], final[8]]]))
    data = [trace]
    py.plot(data, filename='Monitores PRUEBA')
コード例 #6
0
ファイル: app.py プロジェクト: arfsarfy/Exam-2
def update_PieChart(ds):
    return {
        'data': [
            go.Table(header=dict(values=list(dataset_dict[ds].columns),
                                 fill=dict(color='#C2D4FF'),
                                 align=['left'] * 5),
                     cells=dict(values=list(
                         dataset_dict[ds][item].values
                         for item in dataset_dict[ds].columns),
                                fill=dict(color='#F5F8FF'),
                                align=['left'] * 5))
        ]
    }
コード例 #7
0
def updateTable(df):
    dfNama = {'Titanic': df_titanic, 'Titanic Outlier Calculation': df_out}
    return {
        'data': [
            go.Table(header=dict(values=list(dfNama[df].columns),
                                 fill=dict(color='#C2D4FF'),
                                 align=['left'] * 5),
                     cells=dict(
                         values=[dfNama[df][i] for i in dfNama[df].columns],
                         fill=dict(color='#F5F8FF'),
                         align=['left'] * 5))
        ]
    }
コード例 #8
0
def get_unit_metadata(cached_rul_data):
    cached_rul_data = json.loads(cached_rul_data)
    install_date = '02/10/2017<br>'
    last_maintenance_date = '27/09/2018<br>'
    cycles_since_last_maintenance = cached_rul_data['cyclesSoFar']
    trace0 = go.Table(
        header=dict(values=['<b>Install Date</b>', '<b>Maintenance Date</b>'],
                    line = dict(color='rgb(49,130,189)'),
                    fill = dict(color='rgb(49,130,189)'),
                    font = dict(color = 'white'),
                    align = ['center']*2),
        cells=dict(values=[install_date,last_maintenance_date],
                   line = dict(color='rgb(49,130,189)'),
                   fill = dict(color='rgb(49,130,189)'),
                   font = dict(color = 'white'),
                   align = ['center'] * 2,
        ),
        domain=dict(y=[0,0.5])
    )
    trace1 = go.Table(
        header=dict(values=['<b>Cycles so far</b><br>'],
                    line = dict(color='rgb(49,130,189)'),
                    fill = dict(color='rgb(49,130,189)'),
                    font = dict(color = 'white'),
                    height = 40,
                    align = ['center']),
        cells=dict(values=[cycles_since_last_maintenance],
                   line = dict(color='rgb(49,130,189)'),
                   fill = dict(color='rgb(49,130,189)'),
                   font = dict(color = 'white', size = 46),
                   height = 70,
                   align = ['center'],
        ),
        domain=dict(y=[0.5,1]),
    )
    layout = dict(height=400)
    data = [trace0,trace1]
    fig = dict(data=data, layout=layout)
    return fig
コード例 #9
0
def serve_recent_plays_table(plays=None):
    """
    in:
        plays: list of plays, each in nhl api's format
        return: go.Table object with the 5 most recent plays
    """
    layout_dict = dict(title='Recent Plays', margin=dict(l=0, r=0, t=30, b=0))
    header = dict(values=['Play', '(x,y)'])
    cells = dict(values=[[], []])
    if plays:
        cells = _get_recent_table_cells(plays)
    return go.Figure(data=[go.Table(header=header, cells=cells)],
                     layout=layout_dict)
コード例 #10
0
ファイル: tes.py プロジェクト: admajaput/Myfirst_Dashplotly
def update_graph(fiture,target):
    xtable = mydata.groupby(fiture).mean()[target].reset_index()
    return[
        html.Td([
            dcc.Graph(
                id='table_go',
                figure={
                    'data':[
                        go.Bar(
                        x=mydata[fiture],
                        y=mydata[target],
                        text=mydata[target],
                        name='try',
                        marker=dict(color='blue'),
                        legendgroup = 'target'
                    )],
                    'layout': go.Layout(
                        xaxis={'title': fiture.capitalize()}, yaxis={'title': target.capitalize()},
                        margin={'l': 40, 'b': 40, 't': 10, 'r': 10},
                        width=700,
                        height=500,
                        legend={'x': 0, 'y': 1.2}, hovermode='closest',
                        boxmode='group',violinmode='group',
                        #plot_bgcolor= 'black', paper_bgcolor= 'black'
                    )
                }
            )   
        ],colSpan='2',style={'width': '900px'}),
        html.Td([
                dcc.Graph(
                id='table_go2',
                figure={
                        'data':[ go.Table(
                                header=dict(
                                    values=['<b>'+col.capitalize()+'<b>' for col in xtable.columns],
                                    fill = dict(color='#C2D4FF'),
                                    font = dict(size=11),
                                    height= 30,
                                    align = ['center']),
                                cells=dict(
                                    values=[xtable[col] for col in xtable.columns],
                                    fill= dict(color='#F5F8FF'),
                                    font=dict(size=11),
                                    height= 25,
                                    align = ['right']*5)    
                        )],
                        'layout':go.Layout(width=300, height=300, margin={'l': 40, 'b': 40, 't': 10, 'r': 10})
                }
        )
        ],style={'position': 'absolute', 'width': '300px'})
    ]
コード例 #11
0
    def plot_hyper_authorship(self, earliest):

        # get results from aap as a pandas dataframe 
        table = self.cassandra_tbls["hyperauthor"]
        df = self.session.execute("SELECT hyper_authorship_year, hyper_authorship_count FROM " + table + ";",
                                  timeout=None)._current_rows

        # convert year to numeric 
        df[["hyper_authorship_year"]] = df[["hyper_authorship_year"]].apply(pd.to_numeric) 
        
        # get only records which are greater or equal to the year passed
        df = df[(df["hyper_authorship_year"] >= earliest)]

        # set column names 
        df.columns = ["year", "No. of Publications"]

        # set year column as index
        df.set_index("year", inplace=True)

        # sort dataframe by year 
        df.sort_values(by=["year"], 
                       ascending=False, 
                       inplace=True)
        
        # set table title 
        first_year = df.head(1).index.values[0]
        last_year = df.tail(1).index.values[0]
        tbl_title = "Publications with >= 100 Authors from {} to {}.".format(first_year, last_year)

        # show table using pyplot 
        trace = go.Table(
                header=dict(values=["year"] + list(df.columns),
                            fill = dict(color='#C2D4FF'),
                            align = ['left'] * 5),
                cells=dict(values=[df.index.values, 
                                   df["No. of Publications"]],
               fill = dict(color='#F5F8FF'),
               align = ['left'] * 5))

        layout = dict(width=800, height=800)
        table_result = [trace] 
        fig = dict(data=table_result, layout=layout)
        iplot(fig, filename = "pandas_table")

        # plot authorship goes hyper
        iplot(df[["No. of Publications"]].iplot(
                                       asFigure=True,
                                       kind="scatter",
                                       xTitle="Year",
                                       yTitle="No. of Publications",
                                       title=tbl_title))    
コード例 #12
0
def StasData(dfDischarge, stats_list=[mae, r_squared, nse, kge_2012]):

    #stats_list=[mae, r_squared, nse, kge_2012]

    stats_compute = []
    header_entries = []  #['Model']

    for stat in stats_list:
        stats_compute.append(stat.abbr)
        header_entries.append(stat.name)

    header = dict(values=None)  # [])

    #cells=[]
    cells = [header_entries]

    tab = calc_stats(dfDischarge, stats_compute)
    row = []  # [st.name]
    for st in stats_list:
        stat = st.abbr
        if tab[stat][0] != tab[stat][0]:
            row.append('N/A')
        elif isinstance(tab[stat][0], str):
            row.append(tab[stat][0])
        else:
            row.append('{:.2f}'.format(tab[stat][0]))
    cells.append(row)

    cells_ok = dict(values=cells)

    #print(cells)

    #table = ff.create_table(cells)

    trace = go.Table(
        header=header,
        cells=cells_ok,
        domain=dict(x=[0.55, 1.0], y=[0.1, 0.9]),
    )

    #data = [trace]
    #layout = go.Layout(title='Models performance',
    #                   height=400,
    #                   width=400,
    #                   showlegend=False
    #                   )
    #figure = dict(data=data, layout=layout)
    #div = opy.plot(figure, auto_open=False, output_type='div', config=config)
    #div = opy.plot(table, auto_open=False, output_type='div', config=config)

    return trace  # table
コード例 #13
0
ファイル: app.py プロジェクト: Joklost/manet-simulations
def build_histogram_for_stochastic_in_angle_buckets(log: str):
    measured_log = create_linkpairs(log, remove_distance=True)
    count, fixed = parse_linkpairs_to_angle_bucket_sorted(measured_log,
                                                          interval=3)

    hist_data = []
    table_angle = []
    table_avg_rssi = []
    table_median = []
    for i, angle in enumerate(_gen_angle_buckets(interval=3)):
        if angle not in fixed.keys() or len(fixed[angle]) < 1:
            continue

        data = fixed[angle]
        hist_data.append(
            go.Histogram(
                # x=[val / sum(fixed[angle]) for val in fixed[angle]], # normalized value
                x=data,
                name=_str_angle_bucket(interval=3)[i],
                histnorm='percent'  # count presented as percentage
            ))
        table_angle.append(_str_angle_bucket(interval=3)[i])
        table_avg_rssi.append(sum(data) / len(data))
        table_median.append(statistics.median(data))

    log_name = parse_logfile_name(log)
    hist_layout = go.Layout(xaxis=dict(
        title='Difference in RSSI minus distance fading between a link pair'),
                            yaxis=dict(title='Percentage'),
                            title=f'{log_name} - Raw - Sample size: {count}')
    hist_fig = go.Figure(data=hist_data, layout=hist_layout)
    hist_div = plotly.offline.plot(hist_fig, t)

    table_trace = [
        go.Table(header=dict(values=['Angle', 'Average RSSI', 'Median'],
                             line=dict(color='#7D7F80'),
                             fill=dict(color='#a1c3d1'),
                             align=['left'] * 5),
                 cells=dict(values=[table_angle, table_avg_rssi, table_median],
                            align=['left'] * 5))
    ]
    table_layout = dict(width=800)
    table_fig = go.Figure(data=table_trace, layout=table_layout)
    table_div = plotly.offline.plot(table_fig,
                                    include_plotlyjs=False,
                                    output_type='div')

    with open(f'plots/histogram_raw_{log_name}.html', 'w') as f:
        f.write(hist_div)
        f.write(table_div)
コード例 #14
0
ファイル: app.py プロジェクト: devpog/bdf
def generate_html_table(df):
    table = go.Table(header=dict(
        values=list(df.columns),
        font=dict(size=10),
        line=dict(color='rgb(50, 50, 50)'),
        align='left',
        fill=dict(color='#d562be'),
    ),
                     cells=dict(values=[df[k].tolist() for k in df.columns],
                                line=dict(color='rgb(50, 50, 50)'),
                                align='left',
                                fill=dict(color='#f5f5fa')))

    return table
コード例 #15
0
def printConfusionMatrix(confMatrix, outputPath, filename, technique, loss,
                         scaler):
    # Temporarily used until print of all matrices is fixed
    amtSamples = sum(confMatrix.values())

    trace = go.Table(header={'values': [f'Samples = {amtSamples}', 'Predicted good', 'Predicted bad']}, \
        cells={'values': [['Actually good', 'Actually bad'], \
            [confMatrix['TruePositives'], confMatrix['FalsePositives']], \
            [confMatrix['FalseNegatives'], confMatrix['TrueNegatives']]], \
            'height': 40})
    layout = dict(width=700, height=400, font=dict(family='"Open Sans", verdana, arial, sans-serif', size=18, color='#444'), \
        title=f'Confusion matrix {technique}<br>Scaler={scaler}' + (f', Loss={loss}' if loss != None else ''))
    fig = dict(data=[trace], layout=layout)
    pio.write_image(fig, os.path.join(outputPath, filename + '.png'))
コード例 #16
0
def return_figures():
    """Creates four plotly visualizations

    Args:
        None

    Returns:
        list (dict): list containing the four plotly visualizations

    """

    # load data
    engine = create_engine('sqlite:///../data/DisasterResponse.db')
    df = pd.read_sql_table('InsertTableName', engine)

    # Extract data for 1st graph
    words_per_sms_list = []
    for sentence in df['message']:
        words_per_sms_list.append(len(sentence.split()))

    graph_one = []
    graph_one.append(
        go.Histogram(x=words_per_sms_list,
                     xbins=dict(start=1, end=200, size=1),
                     histnorm='probability'))
    layout_one = dict(
        title='Number of words per SMS',
        xaxis=dict(title='#words'),
        yaxis=dict(title='Probability'),
    )

    # second chart Gives us a "peeking" table to see how the messages look
    graph_two = []

    graph_two.append(
        go.Table(header=dict(values=['Raw Messages'],
                             fill=dict(color='#C2D4FF')),
                 cells=dict(values=[df.message], fill=dict(color='#F5F8FF'))))

    layout_two = dict(
        title='Data peek',
        xaxis=dict(title='Values'),
        yaxis=dict(title='Columns'),
    )

    # append all charts to the figures list
    figures = []
    figures.append(dict(data=graph_one, layout=layout_one))
    figures.append(dict(data=graph_two, layout=layout_two))
    return figures
コード例 #17
0
def plot_table(df, title='missing', online=False):
    trace = go.Table(header=dict(values=df.columns.tolist(),
                                 fill={'color': '#C2D4FF'},
                                 align=['left'] * 2),
                     cells=dict(values=[df[col] for col in df.columns],
                                fill={'color': '#F5F8FF'},
                                align=['left'] * 2))

    data = [trace]

    if online:
        py.iplot(data, filename=title)
    else:
        iplot(data, filename=title)
コード例 #18
0
def calc_table(analysis_fields, data_frame):
    median = data_frame[analysis_fields].median().round(2).tolist()
    total = data_frame[analysis_fields].sum().round(2).tolist()
    total_perc = [str(x) + " (" + str(round(x / sum(total) * 100, 1)) + " %)" for x in total]

    # calculate graph
    anchors = []
    for field in analysis_fields:
        anchors.append(calc_top_three_anchor_loads(data_frame, field))
    table = go.Table(domain=dict(x=[0, 1], y=[0.0, 0.2]),
                     header=dict(values=['Surface', 'Total [MWh/yr]', 'Median [MWh/yr]', 'Top 3 most irradiated']),
                     cells=dict(values=[analysis_fields, total_perc, median, anchors]))

    return table
コード例 #19
0
def skewConclusion(df, colNames):
    """This function creates a table for short analysis on the Skewness of the dataset.
    
    Args:
        df (pandas.DataFrame): The pandas dataframe that contains data columns to be analysed.
        colNames (list): The list of column names to be analysed.
    
    Returns:
        dict: A dict with skew conclusion plotly table and its label.
    """

    skew1 = df[colNames[0]].skew()
    skew2 = df[colNames[1]].skew()
    description1 = ''
    description2 = ''
    if skew1 > 1:
        description1 = 'The data has right-skewed distribution, there is a long tail in the positive direction on the number line. The mean is also to the right of the peak.'
    elif skew1 < -1:
        description1 = 'The data has left-skewed distribution, there is a long tail in the negative direction on the number line. The mean is also to the left of the peak.'
    else:
        description1 = 'The data has normal distribution.'

    if skew2 > 1:
        description2 = 'The data has right-skewed distribution, there is a long tail in the positive direction on the number line. The mean is also to the right of the peak.'
    elif skew2 < -1:
        description2 = 'The data has left-skewed distribution, there is a long tail in the negative direction on the number line. The mean is also to the left of the peak.'
    else:
        description2 = 'The data has normal distribution.'

    trace = go.Table(header=dict(values=[['<b>Conclustion</b>']],
                                 line=dict(color='#506784'),
                                 fill=dict(color='#119DFF'),
                                 align=['left', 'center'],
                                 font=dict(color='white', size=12),
                                 height=40),
                     cells=dict(values=[[
                         "<b> %s: </b>" % (colNames[0]) + description1,
                         "<b> %s: </b>" % (colNames[1]) + description2
                     ]],
                                line=dict(color='#506784'),
                                fill=dict(color=['#25FEFD', 'white']),
                                align=['left', 'center'],
                                font=dict(color='#506784', size=12),
                                height=30))
    data = [trace]
    layout = go.Layout(
        dict(title="Skewness conclusion for " + str(colNames[0]) + ", " +
             str(colNames[1])))
    fig = go.Figure(data=data, layout=layout)
    return {"label": "Skew Conclusion", "plot": fig}
コード例 #20
0
def table_pets_by_age():
    trace = go.Table(header=dict(values=['Pet Names', 'Pet Breeds'],
                                 line=dict(color='#7D7F80'),
                                 fill=dict(color='#a1c3d1'),
                                 align=['left'] * 5),
                     cells=dict(values=[table_N_values, table_B_values],
                                line=dict(color='#7D7F80'),
                                fill=dict(color='#EDFAFF'),
                                align=['left'] * 5))

    layout = dict(width=500, height=300)
    data = [trace]
    fig = dict(data=data, layout=layout)
    py.plot(fig, filename='pets_table')
コード例 #21
0
ファイル: utils2.py プロジェクト: akshay1892/test123
def KSTable(oneDf): 
    
    plotly.offline.init_notebook_mode(connected=True)
    trace = go.Table (
    header=dict(values=oneDf.columns,
                fill = dict(color='#C2D4FF'),
                align = ['left'] * 5),
    cells=dict(values=[oneDf.min_scr,oneDf.max_scr,oneDf.bads,oneDf.goods,oneDf.total,oneDf.bad_rate,oneDf.good_rate,oneDf.ks,oneDf.max_ks],
               fill = dict(color='#F5F8FF'),
               align = ['left'] * 5))

    data = [trace] 
    
    plotly.offline.iplot(data, filename = 'pandas_table')
コード例 #22
0
def table_plot(head=[], data=[], data_format=[], title=''):
    fig = go.Figure(data=[
        go.Table(header=dict(values=list(head),
                             fill_color='LightSteelBlue',
                             line_color='SlateGray',
                             align='center'),
                 cells=dict(values=data,
                            fill=dict(color=['PowderBlue', 'aliceblue']),
                            format=data_format,
                            line_color='LightSteelBlue',
                            align='center')),
    ])
    fig.update_layout(title_text=title, title_x=0.5, width=800, height=880)
    plot(fig)
コード例 #23
0
def coverage_by_categories(category_field, df,
                           product_url_fields) -> go.FigureWidget:
    if category_field not in df.columns:
        return None
    if df[category_field].notnull().sum() == 0:
        return None

    cat_grouping = (
        df.groupby(category_field)[category_field].count().sort_values(
            ascending=False).head(20))
    category_values = cat_grouping.values
    category_names = cat_grouping.index

    if product_url_fields is not None and product_url_fields[0] in df.columns:
        product_url_field = product_url_fields[0]
        category_urls = [
            df[df[category_field] == cat][product_url_field].head(1).values[0]
            for cat in category_names
        ]
        href_tag = '<a href="{}">{}</a>'
        category_names = [
            href_tag.format(link, cat)
            for cat, link in zip(category_names, category_urls)
        ]

    trace = go.Table(
        columnorder=[1, 2],
        columnwidth=[400, 80],
        header=dict(
            values=[f"CATEGORY", "SCRAPED ITEMS"],
            fill=dict(color="gray"),
            align=["left"] * 5,
            font=dict(color="white", size=12),
            height=30,
        ),
        cells=dict(
            values=[category_names, category_values],
            fill=dict(color="lightgrey"),
            font=dict(color="black", size=12),
            height=30,
            align="left",
        ),
    )
    layout = go.Layout(
        title=f"Top 20 Categories for '{category_field}'",
        autosize=True,
        margin=dict(t=30, b=25, l=0, r=0),
        height=(len(category_names) + 2) * 45,
    )
    return go.FigureWidget(data=[trace], layout=layout)
コード例 #24
0
def VisualizeWithTable():

    trace = go.Table(
        header=dict(values=[
            'Greater Philadelphia Area', 'Greater Detroit Area',
            'San Francisco Bay Area'
        ]),
        cells=dict(values=[
            [6, 4],
            [33, 10],
            [106, 95]  #degree(higher than bachelor's degree)
        ]))
    data = [trace]
    py.plot(data, filename='visual_table')
コード例 #25
0
    def players_table(): 
        x = Search.players_brief()
        df_players =pd.DataFrame(x,columns=['Rank','Name','Hit','Run','HR','AVG','OPS'])

        trace = go.Table(
            header=dict(values=df_players.columns,
                        fill = dict(color='#C2D4FF'),
                        align = ['left'] * 5),
            cells=dict(values=[df_players.Rank, df_players.Name, df_players.Hit, df_players.Run, df_players.HR, df_players.AVG, df_players.OPS],
                       fill = dict(color='#F5F8FF'),
                       align = ['left'] * 5))

        data = [trace] 
        py.iplot(data, filename = 'pandas_table')
コード例 #26
0
ファイル: app.py プロジェクト: soorajpu12/newdash1
def update_graph(column):
    value_header = ['Date']
    value_cell = [df5['formatted_date']]
    for col in column:
        value_header.append(col)
        value_cell.append(df5[col])
    trace = go.Table(
        header={"values": value_header, "fill": {"color": "#FFD957"}, "align": ['center'], "height": 35,
                "line": {"width": 2, "color": "#685000"}, "font": {"size": 15}},
        cells={"values": value_cell, "fill": {"color": "#FFE89A"}, "align": ['left', 'center'],
               "line": {"color": "#685000"}})
    layout = go.Layout(plot_bgcolor = colors['background'],
                  paper_bgcolor = colors['background'],title="Entry Draft", height=600)
    return {"data": [trace], "layout": layout}
コード例 #27
0
def generate_ces_pd_table(f_df, course_code, width=530, height=315):
  
  h = ['<br>Year<br>', '<br>S<br>', '<br>Pop<br>', '<br>Rel<br>',
       '<br>OSI<br>', '<br>GTS<br>', '<br>Q1<br>', '<br>Q2<br>',
       '<br>Q3<br>', '<br>Q4<br>', '<br>Q5<br>', '<br>Q6<br>']
  trace = go.Table(
    type='table',
    columnorder=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
    columnwidth=[20, 10, 20, 15, 20, 20, 20, 20, 20, 20, 20, 20],
    header=dict(line=dict(color=rc.RMIT_White),
                values=h,
                font=dict(size=18,
                          color=rc.RMIT_White),
                height=40,
                fill=dict(color=rc.RMIT_DarkBlue)
                ),
    cells=dict(line=dict(color=[rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_White, rc.RMIT_White]),
               values=[f_df.year, f_df.semester, f_df.population, f_df.reliability,
                       f_df.osi, f_df.gts,
                       f_df.gts1, f_df.gts2, f_df.gts3, f_df.gts4, f_df.gts5, f_df.gts6],
               font=dict(size=12,
                         color=[rc.RMIT_White, rc.RMIT_White,
                                rc.RMIT_Black, rc.RMIT_Black,
                                rc.RMIT_Black, rc.RMIT_Black,
                                rc.RMIT_Black, rc.RMIT_Black,
                                rc.RMIT_Black, rc.RMIT_Black,
                                rc.RMIT_Black, rc.RMIT_Black]),
               height=28,
               fill=dict(
                 color=[rc.RMIT_DarkBlue, rc.RMIT_DarkBlue,
                        rc.RMIT_Arctic, rc.RMIT_Arctic,
                        rc.RMIT_Azure, rc.RMIT_Azure,
                        rc.RMIT_Arctic, rc.RMIT_Arctic,
                        rc.RMIT_Azure, rc.RMIT_Azure,
                        rc.RMIT_Arctic, rc.RMIT_Arctic]),
               ),
  )
  
  layout = go.Layout(width=width,
                     height=height,
                     margin=dict(b=0, l=0, r=0, t=0))
  data = [trace]
  fig = dict(data=data, layout=layout)
  return fig
コード例 #28
0
def buildTableFig(myData, title):
    print("myData=", myData)
    if (title == "Pump and Valve Programming"):
        fig = go.Figure(
            data=[
                go.Table(
                    columnwidth=[
                        150, 200, 150, 500, 150, 150, 150, 150, 150, 150
                    ],
                    header=dict(values=[
                        ['<b>ID</b>'],
                        ['<b>Unit Name</b>'],
                        ['<b>Valve Number</b>'],
                        ['<b>Control</b>'],
                        ['<b>MS Threshold</b>'],
                        ['<b>DOW Filter (Su-Sa)</b>'],
                        ['<b>Time Select</b>'],
                        ['<b>Start Time</b>'],
                        ['<b>On Time (Seconds)</b>'],
                        ['<b>Show Graph</b>'],
                    ],
                                line_color='darkslategray',
                                fill_color='royalblue',
                                align=['left', 'center'],
                                font=dict(color='white', size=12),
                                height=40),
                    cells=dict(
                        values=myData,
                        line_color='darkslategray',
                        # 2-D list of colors for alternating rows
                        fill_color=[[
                            rowOddColor, rowEvenColor, rowOddColor,
                            rowEvenColor
                        ] * 10],
                        fill=dict(color=['paleturquoise', 'white']),
                        align=['left', 'center'],
                        font_size=12,
                        height=30),
                )
            ],
            layout={
                "title": title,
                "autosize": True,
                "height": 1500
            },
        )
        return fig

    fig = html.H1(children="Error in print system log")
コード例 #29
0
ファイル: main7.py プロジェクト: aminkhod/Abacus_Daily_Report
def NonMoving():
    df = pd.read_csv('allMonthes.csv')
    newdf = df[df['Stock Status'] == 'Non moving']
    newdf = newdf.loc[:, [
        'Sku', 'UPC', 'Catalogue N', 'Title', 'Label', 'Arq COST',
        "Cost Price", 'V.S.P.'
    ]].reindex()
    trace = go.Table(header=dict(values=[
        'Sku', 'UPC', 'Catalogue N', 'Title', 'Label', 'Arq COST',
        "Cost Price", 'V.S.P.'
    ]),
                     cells=dict(values=np.transpose(newdf.values[:, :])))
    data = [trace]
    plot(data, filename='NonMoving.html')
    return render_template('NonMoving.html')
コード例 #30
0
ファイル: figures.py プロジェクト: greatestgoat/EDA_Dashboard
def serve_table_data(ds_df):

    # Colorscale
    bright_cscale = [[0, '#FF0000'], [1, '#0000FF']]

    trace = go.Table(
        header=dict(values=ds_df.columns),
        cells=dict(values=[ds_df.loc[:, i] for i in ds_df.columns]))

    layout = go.Layout(margin=dict(l=100, r=100, t=100, b=100), )

    data = [trace]
    figure = go.Figure(data=data, layout=layout)

    return figure