The train is a data frame in which I have two columns:
Address gender
0 abc f
1 dfg m
2 hjk m
3 ert m
when genders are the same I need to perform some operation on the address column so I am using this code moreover I am new to python and pandas so I don't know if I am doing it correctly and efficiently.
for i in train.index:
for j in train.index[i+1]:
if train.loc[i,'gender']== train.loc[j,'gender']:
print(train['Address'])
currently, this code is giving an error:
'int' object is not iterable
can anyone please help me solve this issue?