我的数据帧中每行的列数是动态的,单个记录可以超过1行。前2列是键列。如果键列匹配,我必须将每一行数据追加到一行中,并根据追加所需创建尽可能多的列。在
输入在(数据帧)c1以下的列c2中的列等。。。在
row 1: A 1 c1 c2 c3.. c20
row 2: A 1 c21....c25
row 3. A 1 c26.... c35
row 4: A 2 d1 d2... d21
row 5: A 2 d22....d27
我试着用分组数据框(\uuUu first 2列名)。first().reset\u index(),它只返回第一行,因为我们使用的是first()。在python中有什么函数可以做到这一点吗
需要输出:(数据帧)
^{pr2}$
使用^{} 表示一系列计数器,然后在列表理解中使用^{} 、^{} 和最后一个展平
MultiIndex
:相关问题 更多 >
编程相关推荐