當前位置: 首頁>>代碼示例>>Python>>正文


Python dash_html_components.Th方法代碼示例

本文整理匯總了Python中dash_html_components.Th方法的典型用法代碼示例。如果您正苦於以下問題:Python dash_html_components.Th方法的具體用法?Python dash_html_components.Th怎麽用?Python dash_html_components.Th使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dash_html_components的用法示例。


在下文中一共展示了dash_html_components.Th方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: compute_stats

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def compute_stats(questions: List[Question], db_path):
    n_total = len(questions)
    n_guesser_train = sum(1 for q in questions if q.fold == 'guesstrain')
    n_guesser_dev = sum(1 for q in questions if q.fold == 'guessdev')
    n_buzzer_train = sum(1 for q in questions if q.fold == 'buzzertrain')
    n_buzzer_dev = sum(1 for q in questions if q.fold == 'buzzerdev')
    n_dev = sum(1 for q in questions if q.fold == 'dev')
    n_test = sum(1 for q in questions if q.fold == 'test')
    columns = ['N Total', 'N Guesser Train', 'N Guesser Dev', 'N Buzzer Train', 'N Buzzer Dev', 'N Dev', 'N Test']
    data = np.array([n_total, n_guesser_train, n_guesser_dev, n_buzzer_train, n_buzzer_dev, n_dev, n_test])
    norm_data = 100 * data / n_total

    return html.Div([
        html.Label('Database Path'), html.Div(db_path),
        html.H2('Fold Distribution'),
        html.Table(
            [
                html.Tr([html.Th(c) for c in columns]),
                html.Tr([html.Td(c) for c in data]),
                html.Tr([html.Td(f'{c:.2f}%') for c in norm_data])
            ]
        )
    ]) 
開發者ID:Pinafore,項目名稱:qb,代碼行數:25,代碼來源:qb_stats.py

示例2: generate_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def generate_table(dataframe, max_rows=100):
    max_value = df.max(numeric_only=True).max()
    min_value = df.min(numeric_only=True).max()
    rows = []
    for i in range(min(len(dataframe), max_rows)):
        row = []
        for col in dataframe.columns:
            value = dataframe.iloc[i][col]
            style = cell_style(value, min_value, max_value)
            row.append(html.Td(value, style=style))
        rows.append(html.Tr(row))

    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        rows) 
開發者ID:plotly,項目名稱:dash-recipes,代碼行數:20,代碼來源:dash-table-conditional-formatting.py

示例3: Table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def Table(dataframe):
    rows = []
    for i in range(len(dataframe)):
        row = []
        for col in dataframe.columns:
            value = dataframe.iloc[i][col]
            # update this depending on which
            # columns you want to show links for
            # and what you want those links to be
            if col == 'id':
                cell = html.Td(html.A(href=value, children=value))
            else:
                cell = html.Td(children=value)
            row.append(cell)
        rows.append(html.Tr(row))
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        rows
    ) 
開發者ID:plotly,項目名稱:dash-recipes,代碼行數:23,代碼來源:dash-html-table-hyperlinks.py

示例4: generate_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def generate_table(df, max_rows=10):
    return html.Table(className="responsive-table",
                      children=[
                          html.Thead(
                              html.Tr(
                                  children=[
                                      html.Th(col.title()) for col in df.columns.values],
                                  style={'color':app_colors['text']}
                                  )
                              ),
                          html.Tbody(
                              [
                                  
                              html.Tr(
                                  children=[
                                      html.Td(data) for data in d
                                      ], style={'color':app_colors['text'],
                                                'background-color':quick_color(d[2])}
                                  )
                               for d in df.values.tolist()])
                          ]
    ) 
開發者ID:Sentdex,項目名稱:socialsentiment,代碼行數:24,代碼來源:dash_mess.py

示例5: display

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def display(btn1, btn2, btn3):
    ctx = dash.callback_context

    if not ctx.triggered:
        button_id = 'No clicks yet'
    else:
        button_id = ctx.triggered[0]['prop_id'].split('.')[0]

    ctx_msg = json.dumps({
        'states': ctx.states,
        'triggered': ctx.triggered,
        'inputs': ctx.inputs
    }, indent=2)

    return html.Div([
        html.Table([
            html.Tr([html.Th('Button 1'),
                     html.Th('Button 2'),
                     html.Th('Button 3'),
                     html.Th('Most Recent Click')]),
            html.Tr([html.Td(btn1 or 0),
                     html.Td(btn2 or 0),
                     html.Td(btn3 or 0),
                     html.Td(button_id)])
        ]),
        html.Pre(ctx_msg)
    ]) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:29,代碼來源:last_clicked_button.py

示例6: generate_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def generate_table(dataframe, max_rows=10):
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        [html.Tr([
            html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
        ]) for i in range(min(len(dataframe), max_rows))]
    ) 
開發者ID:plotly,項目名稱:dash-recipes,代碼行數:12,代碼來源:dash_sqlite.py

示例7: create_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def create_table(df):
    columns = ['Magnitude', 'Latitude', 'Longitude', 'Time', 'Place', 'Detail']
    num_rows = data['metadata']['count']
    thead = html.Thead(html.Tr([html.Th(col) for col in columns]))
    table_rows = list()
    for i in range(num_rows):
        tr = html.Tr(
            children=list(map(functools.partial(create_td, df.iloc[i]),
                              columns)))
        table_rows.append(tr)
    tbody = html.Tbody(children=table_rows)
    table = html.Table(children=[thead, tbody], id='my-table')
    return table 
開發者ID:jackdbd,項目名稱:dash-earthquakes,代碼行數:15,代碼來源:app.py

示例8: generate_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def generate_table(dataframe, max_rows=10):
    return html.Table([
        html.Thead(
            html.Tr([html.Th(col) for col in dataframe.columns])
        ),
        html.Tbody([
            html.Tr([
                html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
            ]) for i in range(min(len(dataframe), max_rows))
        ])
    ]) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:13,代碼來源:getting_started_table.py

示例9: html_table

# 需要導入模塊: import dash_html_components [as 別名]
# 或者: from dash_html_components import Th [as 別名]
def html_table(
    df,
    base_column_style={},
    table_style={},
    column_style={},
    cell_style={},
    cell_style_by_column={},
    header_style={},
    header_style_by_column={},
    row_style={},
    row_style_by_index={},
    odd_row_style={},
    conditional_cell_style=(lambda cell, column: {})
):
    header = []
    for column in df.columns:
        header.append(
            html.Th(
                column,
                style=merge(
                    row_style,
                    base_column_style,
                    cell_style,
                    column_style.get(column, {}),
                    header_style,
                    header_style_by_column.get(column, {}),
                ),
            )
        )

    rows = []
    for i in range(len(df)):
        row = []
        for column in df.columns:
            row.append(
                html.Td(
                    df.iloc[i][column],
                    style=merge(
                        row_style,
                        row_style_by_index.get(i, {}),
                        odd_row_style if i % 2 == 1 else {},
                        cell_style,
                        cell_style_by_column.get(column, {}),
                        conditional_cell_style(df.iloc[i][column], column)
                    ),
                )
            )
        rows.append(html.Tr(row))

    return html.Table(
        [html.Thead(header), html.Tbody(rows)],
        style=merge(table_style, {"marginTop": "20px", "marginBottom": "20px"}),
    ) 
開發者ID:plotly,項目名稱:dash-docs,代碼行數:55,代碼來源:utils.py


注:本文中的dash_html_components.Th方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。