Suppose I have the following dataframe:
pd.DataFrame({\'col1\': [\"a\", \"a\", np.nan, np.nan, np.nan], \'override1\': [\"b\", np.nan, \"b\",
With focus on performance, here's one with NumPy -
In [106]: idx = df.shape[1] - 1 - df.notnull().to_numpy()[:,::-1].argmax(1) In [107]: pd.Series(df.to_numpy()[np.arange(len(df)),idx]) Out[107]: 0 c 1 a 2 b 3 c 4 NaN dtype: object