So I have this dataframe Ttrain where the sex column has 2 unique values male and female. What I need to do is run a loop, where the unique values from a column will be extracted and assigned to unique variables. So for sex column, a[1]= male and a[2] = female should be the output. I'm trying the following code:
u=Ttrain.Sex.unique()
a=[]
for i in range(len(u)):
a.append(i)=u[i]
print (a(i))
But I'm getting the following error:
SyntaxError: can't assign to function call
Please pardon my lack of knowledge because I've just started programming 2 weeks back. Any help/suggestion will be highly appreciated. Thank you.