Is there an efficient way to make the following assignment without using for loops?
for i in range(0,len(df3)):
if df3.loc[i,'field'] == "a":
df3.loc[i,'field'] = "111"
elif df3.loc[i, 'field'] == "b":
df3.loc[i, 'field'] = "222"
elif df3.loc[i, 'field'] == "c":
df3.loc[i, 'field'] = "333"
else:
df3.loc[i,'field'] = "444"
fieldin the last threeelif, butain the first? A typo?df3.loc[df['field']=='a','field'] = '111'and so on you wouldn't need to iterate at all just callloclike above 4 times