假设我有三只熊猫
DF1型
Words Score
The Man 2
The Girl 4
Df2型
Words2 Score2
The Boy 6
The Mother 7
Df3型
Words3 Score3
The Son 3
The Daughter 4
现在,我将它们连接在一起,这样它就变成了一个DF中的6列。这一切都很好,但我想知道,是否有pandas函数将它们垂直堆叠成两列并更改标题?
所以要做这样的东西?
Family Members Score
The Man 2
The Girl 4
The Boy 6
The Mother 7
The Son 3
The Daughter 4
我在这里读到的一切http://pandas.pydata.org/pandas-docs/stable/merging.html似乎只有“水平”的方法加入DF!
只要重命名列,使其在每个数据帧中相同,
pd.concat()
就可以正常工作:相关问题 更多 >
编程相关推荐