熊猫在数据框架中排序和bin数据以使其枢纽
我有一个具有(随机)观察高度,周期和区域的数据框架:
Height = [1, 4, 3, 3, 3, 2, 4, 2, 3, 3, 3, 1, 4, 3, 3, 4, 1, 4, 2, 2]
Period = [5, 4, 2, 4, 2, 2, 3, 3, 5, 2, 4, 5, 4, 2, 4, 4, 3, 5, 4, 3]
Zone = [1,1,3,1,4,1,1,1,1,4,1,3,2,1,4,2,4,4,2,4]
Direction = [292.5, 22.5, 202.5, 337.5, 292.5, 337.5, 337.5, 337.5, 22.5, 292.5, 22.5, 157.5, 112.5, 337.5, 292.5, 112.5, 247.5, 247.5,
112.5, 292.5]
我想在索引上用区域,列上的独特时期,然后对索引柱的每种组合做一个表格,我想拥有高度的最大值:
I have a dataframe with (random) observations for height, period and zones as such:
Height = [1, 4, 3, 3, 3, 2, 4, 2, 3, 3, 3, 1, 4, 3, 3, 4, 1, 4, 2, 2]
Period = [5, 4, 2, 4, 2, 2, 3, 3, 5, 2, 4, 5, 4, 2, 4, 4, 3, 5, 4, 3]
Zone = [1,1,3,1,4,1,1,1,1,4,1,3,2,1,4,2,4,4,2,4]
Direction = [292.5, 22.5, 202.5, 337.5, 292.5, 337.5, 337.5, 337.5, 22.5, 292.5, 22.5, 157.5, 112.5, 337.5, 292.5, 112.5, 247.5, 247.5,
112.5, 292.5]
I want to make a table with the zones on the indices, the unique periods on the columns and then for each combination of index-column I want to have the maximum of the height as such:
Any idea how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试
You can try