"For each row, what is the fastest way to find the column holding nth element that is not NaN?",(df.notnull().cumsum(axis=1) == 4).idxmax(axis=1)