在Python中为表格输出的格式化数据
, [0,1,0], [2,4,2]]))所需的输出是一个表格名称为列的表,矩阵值为行:
hotspur
01
2
teams_list = ["Man Utd", "Man City", "T Hotspur"] data = np.array([[1, 2, 1], [0, 1, 0], [2, 4, 2]])
1.表 | , ['Man City',1,1,0], ['t hotspur',0,1,2]],标题= teams_list)) | teams_list) t.add_rows([[[名称]列表(row)的名称,row in zip(teams_list,data)]) print(t)3。 texttable | 4。 termTables |
---|---|---|---|
terminaltables: Supports multi-line rows. | asciitable: Reads and writes various ASCII table formats. | ||
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3