Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in np.polyfit(RankData.Date, RankData.Rank, 3) #1

Open
utahman opened this issue Aug 24, 2019 · 1 comment
Open

Getting error in np.polyfit(RankData.Date, RankData.Rank, 3) #1

utahman opened this issue Aug 24, 2019 · 1 comment

Comments

@utahman
Copy link

utahman commented Aug 24, 2019


TypeError Traceback (most recent call last)
in
----> 1 weights_date_rank = np.polyfit(RankData.Date, RankData.Rank, 3)
2 model_date_rank = np.poly1d(weights_date_rank)
3 preds_rank = np.round(model_date_rank(RankData.Date))
4 preds_rank[preds_rank<1] = 1

c:\program files\python37\lib\site-packages\numpy\lib\polynomial.py in polyfit(x, y, deg, rcond, full, w, cov)
626 scale = NX.sqrt((lhs*lhs).sum(axis=0))
627 lhs /= scale
--> 628 c, resids, rank, s = lstsq(lhs, rhs, rcond)
629 c = (c.T/scale).T # broadcast scale coefficients
630

c:\program files\python37\lib\site-packages\numpy\linalg\linalg.py in lstsq(a, b, rcond)
2234 # lapack can't handle n_rhs = 0 - so allocate the array one larger in that axis
2235 b = zeros(b.shape[:-2] + (m, n_rhs + 1), dtype=b.dtype)
-> 2236 x, resids, rank, s = gufunc(a, b, rcond, signature=signature, extobj=extobj)
2237 if m == 0:
2238 x[...] = 0

TypeError: No loop matching the specified signature and casting
was found for ufunc lstsq_n

@kienld304
Copy link

RankData.Rank =RankData.Rank.astype(int)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants