I am trying to write a lambda function in Pandas that checks to see if Col1 is a Nan and if so, uses another column\'s data. I have having trouble getting code (below) to c
Assuming that you do have a second column, that is:
df = pd.DataFrame({ 'Col1' : [1,2,3,np.NaN], 'Col2': [1,2,3,4]})
The correct solution to this problem would be:
df['Col1'].fillna(df['Col2'], inplace=True)