I am trying to use field calculator to calculate a field based on unique types in another field. I had to go for a for loop to add new values. I have 81 classes and every class should be assigned an unique number. I am getting some error in my method. I do not have prior experience of using python code in field calculator. I am sharing my code blocks.
def u_biotope(x):
u=list(set(x))
listbt=[]
count=0
for i in u:
btype = count
listbt.append(count)
count=count+1
return listbt
u_biotope( [BIOT1] )
It shows: A field was not found or unbalanced quotation marks
does anyone have any idea, How could I solve this?