y1 = series.values[idxs]
y2 = series.values[idxs + 1]
x_crossings = (cross - y1) * (x2 - x1) / (y2 - y1) + x1
return x_crossings
time = [0, 0.1, 0.21, 0.31, 0.4, 0.49, 0.51, 0.6, 0.71, 0.82, 0.93]
voltage = [1, -1, 1.1, -0.9, 1, -1, 0.9, -1.2, 0.95, -1.1, 1.11]
df = DataFrame(data=voltage, index=time, columns=['voltage'])
x_crossings = cross(df['voltage'])
y_crossings = np.zeros(x_crossings.shape)
plt.plot(time, voltage, '-ob', x_crossings, y_crossings, 'or')
plt.grid(True)
Calculating crossing (intercept) points of a Series or DataFrame