ydata = np.array([[1, 2], [3, 4], [5, 6], [7, 8]], dtype=float)
xdata = np.array([1, 2, 3, 4], dtype=float)
popt, pcov = curve_fit(func, xdata, ydata.T.ravel())
How to properly define vector function for scipy's curve_fit