The error you get is because you mixed loc and iloc, with .loc you need to use the column name and not its index. Just replace your last line by:
df.iloc[num, 1] = df.iloc[num, 0]