calculate the mean of the nonzero values' indices of dataframe `df`,np.flatnonzero(x).mean()