I have column like username
UserName , exam, score
Peter, 1, 70
Richard, 2, 80
Peter, 2, 60
...
would like to convert sth like below and pass as input array for model UserName , exam,score
1,1,70
2,2,80
1,2,60
i can create a new col and do mapping by {'Peter':'1','Richard':'2'....} but any smarter code can do this? or Keras have some API to do that I have around 100 user name in the column
Actually I also think so use function concept like below
def NameToInt(pd):
listName=[]
i=0
for x in pd.unique():
listName.append('X':'i')
i=i+1
return listName
Thanks