Conditionally replace values in column with value from another column I have a 5 column dataframe where one column has some NaN's. My goal is to replace these NaN's with the corresponding value in another column.

So if my DF looks like this:

YearBuilt     LastModified

1993          2004

1994          NaN

1995          2004


I would want to replace the NaN with the corresponding YearBuilt, which is 1994 in this case.
for i in range(df.shape[0]):
    if(df['LastModified'][i].isnull()):
        df.loc[i,'LastModified']==df.loc[i,'YearBuilt']