plt line of best fit

plt.plot(np.unique(x), np.poly1d(np.polyfit(x, y, 1))(np.unique(x)))

Here is what the above code is Doing:
1. np.polyfit(x, y, 1) is fitting a polynomial of degree 1 to the data.
2. np.poly1d() is creating a polynomial function from the coefficients.
3. np.unique(x) is returning the sorted unique elements of the array x.
4. np.poly1d(np.polyfit(x, y, 1))(np.unique(x)) is evaluating the polynomial function at the unique values of x.