Partial Pivoting In Pandas SQL Or Spark

一世执手 提交于 2019-12-08 14:16:02

问题


Partial Pivoting In Pandas SQL Or Spark

Make the Year remain as Rows, and have the States Transpose to columns Take Pecentage value of a Gender Male Race White,

Input

Output


回答1:


Answer Posted By @Peter Leimbigler as comment

df.pivot_table(index='Year', columns='States', values='Percentage')

I tried it works.. Thanks Peter



来源:https://stackoverflow.com/questions/56980886/partial-pivoting-in-pandas-sql-or-spark

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!