a = df.x.values
m = np.concatenate(([True], np.isnan(a), [True]))
ss = np.flatnonzero(m[1:] != m[:-1]).reshape(-1, 2)
start, stop = ss[(ss[:, (1)] - ss[:, (0)]).argmax()]
Pandas - Find longest stretch without Nan values