当前位置: 首页>>代码示例>>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;未经允许,请勿转载。