I have a dataframe with results as below. Sample dataframe shown actual one is much larger. I want to get a dictionary (or another structure if it will be faster) with the
Maybe not the best in terms of performance, but you could use iterrows:
import numpy as np results = {} for i, row in df.iterrows(): results[i] = list(df.columns[~np.isnan(row)])