如何在集成列时如何将Groupby Pandas对象转换为数据框
我想以以下方式将分组的数据帧转换为dataFrame对象:
起点为
整理点是:
重点是将列号集成到category_a category_b
一个人当然可以reset_index并使用循环,通过所有DF获取值并从头开始构造它。但是,这是一个很小的例子,我的数据框架比这更大,我想知道是否有一种更简单的方法可以做到这一点。
谢谢
i would like to transform a grouped dataframe into a dataframe object in the following way:
starting point is
finishing point is:
The point is to integrate the column number into category_a and category_b
one can of course reset_index and with a loop , get the values through all the df and construct it from scratch. however this is a tiny example, and my dataframe is way bigger than that, i was wondering whether there is an easier way to do this.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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