创建一个pandas表

2023-11-30

enter image description here

在使用 pandas 时,如何显示与此类似的表格。

我想我必须使用类似于的数据框df = pandas.DataFrame(results)并显示它display.display(df)但从那里我不知道该怎么办?


您可以将字典传递为data当你使用pd.DataFrame:

>>> import pandas as pd
>>> d = {
...     'Algothime': ['KNN', 'SVM', 'MLP'],
...     'Param. 1': ['-', '-', '-'],
...     'Param. 2': ['-', '-', '-'],
...     'Plage param. 1': ['-', '-', '-'],
...     'Plage param. 2': ['-', '-', '-'],
... }
>>> df = pd.DataFrame(data=d)
>>> df
  Algothime Param. 1 Param. 2 Plage param. 1 Plage param. 2
0       KNN        -        -              -              -
1       SVM        -        -              -              -
2       MLP        -        -              -              -

If you want that specific style you can use Google Colab or something similar if you don't have Jupyter installed locally: Colab Example

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

创建一个pandas表 的相关文章