当前位置: 首页>>代码示例>>Python>>正文


Python Table.header_row方法代码示例

本文整理汇总了Python中table.Table.header_row方法的典型用法代码示例。如果您正苦于以下问题:Python Table.header_row方法的具体用法?Python Table.header_row怎么用?Python Table.header_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在table.Table的用法示例。


在下文中一共展示了Table.header_row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from table import Table [as 别名]
# 或者: from table.Table import header_row [as 别名]
def main():
    # Load command-line arguments
    args = setup_argparser()

    # Setup Tables for storing data
    NAME_COL_WIDTH = 20
    
    new_data_table = Table(col_width=[5,NAME_COL_WIDTH,6,3] + [6,6] + [6,6,6,6] + [10, 6],
                  data_format=["{:d}","{:s}","{:d}","{}","{:.1f}","{:.1f}","{}","{:.1f}","{}","{:.1f}","{:.1%}", "{:.1f}"],
                  col_sep=1)
    
    # Create two-row header
    new_data_table.header_row([(4, ""), (2, "POWER (W)", "-"), (4, "SAMPLE PERIOD (s)", "-"), (2, "")])
    new_data_table.header_row(["#", 
                      "name", 
                      "count", 
                      "s",
                      "min", "max",
                      "min", "mean", "max", "stdev",
                      "% missed",
                      "kwh"
                      ])

    if args.use_cache:
        cache_table = Table(col_width=[5,NAME_COL_WIDTH,6] + [6,6] + [6,6,6] + [10, 6],
                            data_format=["{:d}","{:s}","{:d}","{:.1f}","{:.1f}","{}","{:.1f}","{}","{:.1%}", "{:.1f}"])
        cache_table.header_row([(3, ""), (2, "POWER (W)", "-"), (3, "SAMPLE PERIOD (s)", "-"), (2, "")])
        cache_table.header_row(["#", 
                          "name", 
                          "count", 
                          "min", "max",
                          "min", "mean", "max",
                          "% missed",
                          "kwh"
                          ])
        
        totals_table = copy.deepcopy(cache_table)

    data_available = False
    
    input_tz = pytz.timezone(args.input_timezone)
    
    # Load labels.dat
    try:
        labels = load_labels(args)
    except IOError, e:
        sys.exit(e)
开发者ID:JackKelly,项目名称:powerstats,代码行数:49,代码来源:powerstats.py


注:本文中的table.Table.header_row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。