2 回答
TA贡献2016条经验 获得超9个赞
使用values的价值和keys索引
df = pd.DataFrame(list(dictionary.values()), index=dictionary.keys())
0 1 2
yup chocolate pizza rainbows
tape what milk None
如果需要命名的列 index
df.reset_index()
index 0 1 2
0 yup chocolate pizza rainbows
1 tape what milk None
TA贡献1813条经验 获得超2个赞
将您的价值观转换为pd.Series:
df = pd.DataFrame({k:pd.Series(v) for k,v in dictionary.items()}).T
0 1 2
tape what milk NaN
yup chocolate pizza rainbows
或者:
df = pd.DataFrame.from_dict({k:pd.Series(v) for k,v in dictionary.items()},orient='index')
0 1 2
tape what milk NaN
yup chocolate pizza rainbows
添加回答
举报