行我是新来的大熊猫,熊猫:转换列基于ID
我有以下数据框:
df = pd.DataFrame([[1, 'name', 'peter'], [1, 'age', 23], [1, 'height', '185cm']], columns=['id', 'column','value'])
id column value
0 1 name peter
1 1 age 23
2 1 height 185cm
我需要创建一个单独的行,每个ID 。像这样:
id name age height
0 1 peter 23 185cm
任何帮助非常感谢,谢谢。
欢迎来到StackOverflow。请花时间阅读这篇文章[如何提供一个伟大的熊猫示例](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples)以及如何提供[最小,完整和可验证的示例](http://stackoverflow.com/help/mcve)并相应地修改您的问题。 [如何提出一个好问题](http://stackoverflow.com/help/how-to-ask)上的这些技巧也可能有用。 – jezrael
此外[不要张贴图像的代码(或链接到他们)](http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-所以当提问时) – jezrael
对不起,我没有足够的声望来嵌入图像 – pandalover