While using the code below, im trying to create a trendline. The scattergraph works but is keep getting the error:"LinAlgError: SVD did not converge in Linear Least Squares" when i try to work with the trendline. What am i doing wrong?
code:
import numpy as np
import matplotlib.pyplot as plt
from numpy import genfromtxt
data = genfromtxt("som.csv", delimiter=",")
tijd=data[:, 0]
afstand=data[:, 1]
plt.scatter(tijd, afstand)
z = np.polyfit(tijd, afstand, 2)
p = np.poly1d(z)
plt.plot(tijd,p(tijd),"r--")
i used a method that i have used before with similar data, but while it worked in the past it no longer seems to work.