【发布时间】:2020-08-05 18:46:30
【问题描述】:
df:
Id Products
100 Shoes
101 Shoes
102 Shoes
103 Chair
104 Chair
105 Chair
106 Chair
107 Chair
108 Clothes
109 Clothes
110 Clothes
df_输出:
Id Products Value
100 Shoes 1
101 Shoes 1
102 Shoes 1
103 Chair 2
104 Chair 2
105 Chair 2
106 Chair 2
107 Chair 2
108 Clothes 3
109 Clothes 3
110 Clothes 3
我需要基于“产品”列创建一个新列,该列为每个不同的产品分配每个唯一值。
【问题讨论】:
标签: python python-3.x pandas python-2.7