I have this dataframe
My goal is to fill the Nan values in the 3rd and 4th column with the non-Nan data in each column. Tried shift(-5) but didn't get it to work. Any thoughts?
Use bfill:
df[['col3','col4']] = df[['col3','col4']].bfill()
OR:
df[['col3','col4']] = df[['col3','col4']].fillna(method='bfill')
df.iloc[:5, [2, 3]] = df.iloc[5:, [2, 3]].to_numpy()?