2024-03-28 17:29:28 发布
网友
我有下面的系列。你知道吗
df1 Product M1 Product1 Product2 M2 Product1 Product3 M3 Product1 Product4
pandas中是否有任何资源允许在一行中转置多个索引中的数据?如下面的示例所示。你知道吗
df1 Product ProducNew M1 Product1 Product2 M2 Product1 Product3 M3 Product1 Product4
按索引分组,并创建两列,其中包含首值和结束值
df.groupby(df.index)['Product'].agg(product='first', productNew='last') product productNew M1 Product1 Product2 M2 Product1 Product3 M3 Product1 Product4
您建议的代码返回下面的df。你知道吗
0 0 Product1 1 Product2 2 Product1 3 Product3 4 Product1 5 Product4...
抱歉,我不太清楚,伙计们,我是初学者。你知道吗
按索引分组,并创建两列,其中包含首值和结束值
您建议的代码返回下面的df。你知道吗
抱歉,我不太清楚,伙计们,我是初学者。你知道吗
相关问题 更多 >
编程相关推荐