Dears, I have dataframe contain many columns and rows(40000 rows)as below,
Many rows have "CVLAN_description" column are NAN, I want to fill it by other row has value under some condition if two columns are equal('C-VLAN' and 'SPO Name' ), these means by traditional way i will have two inner for loops to iterate each row to all rows to see if the condition matches or not, that will led to 40000*40000 iterations , these may be take hours in my laptop when running my code:
for index, row in with_VLANe_after.iterrows():
if row['CVLAN_description']!='nan':
for index2, row2 in with_VLANe_after.iterrows():
if row['C-VLAN'] ==row2['C-VLAN'] and
row2['Service_name']=='nan' and row['SPO Name']
==row2['SPO Name'] and
row['S-VLAN'] ==row2['S-VLAN'] : with_VLANe_after.set_value(index2,'CVLAN_description',row['CVLAN_description'])
print (row['CVLAN_description'])
Any one can help me to avoid long time iteration.