【发布时间】:2021-03-17 12:44:09
【问题描述】:
我将字典转换为 pandas DataFrame
import pandas as pd
my_dict = {
0: {1,5,8},
1: {2,7,6},
2: {8,3,7}
}
df = pd.DataFrame.from_dict(my_dict, orient='index', dtype=None, columns=None)
print (df)
输出:
0 1 2
0 8 1 5
1 2 6 7
2 8 3 7
预期输出:
number column
0 1,5,8
1 2,7,6
2 8,3,7
所以列必须包含简单的容器,例如列表或系列。
问题
create pandas dataframe from dictionary of dictionaries
不要描述我的问题,因为我不需要很多专栏。
数据必须存储在 1 列中。
【问题讨论】: