📜  列表列表到表 python 代码示例

📅  最后修改于: 2022-03-11 14:46:46.051000             🧑  作者: Mango

代码示例1
In [22]: import pandas as pd
In [22]: pd.DataFrame(tableData).T # .T means transpose the dataframe
Out[22]:
          0      1      2
0    apples  Alice   dogs
1   oranges    Bob   cats
2  cherries  Carol  moose
3    banana  David  goose
#Remove those annoying numbers by setting columns and indices to blank:
In [27]: l1, l2 = len(tableData), len(tableData[0])
In [28]: pd.DataFrame(tableData, index=['']*l1, columns=['']*l2).T