I wrote a python program but I got below error
code:
import pandas as pd
import numpy
import io
from sklearn.model_selection import train_test_split
from google.colab import files
iodf2 = files.upload()
df=pd.read_csv(io.BytesIO(iodf2['BTC-USDD.csv']))
df.dropna(inplace=True)
df = df[df.iloc[:,0] > 0]
df.iloc[:,0] =numpy.array(df.iloc[:,0], dtype=numpy.int64)
xtrain,xtest,ytrain,ytest=train_test_split(df.iloc[:,0],df.iloc[:,1],test_size=0.3)
from sklearn.metrics import r2_score
model=numpy.poly1d(numpy.polyfit(xtrain,ytrain,400))
p=model(xtest)
score=r2_score(p,ytest)
print(f'Accuracy for degree 100 is {score} ')
Error:
ValueError Traceback (most recent call last)
ValueError: On entry to DLASCL parameter number 4 had an illegal value
The above exception was the direct cause of the following exception:
SystemError Traceback (most recent call last)
in <cell line: 18>() 16 #for degree in range(0,400): 17 ---> 18 model=numpy.poly1d(numpy.polyfit(xtrain,ytrain,400)) 19 p=model(xtest) 20 score=r2_score(p,ytest)
4 frames
/usr/local/lib/python3.10/dist-packages/numpy/linalg/linalg.py in _raise_linalgerror_lstsq(err, flag) 98 99 def _raise_linalgerror_lstsq(err, flag): --> 100 raise LinAlgError("SVD did not converge in Linear Least Squares") 101 102 def _raise_linalgerror_qr(err, flag):
SystemError: <class 'numpy.linalg.LinAlgError'> returned a result with an exception set
file BTC-USDD.csv:
Date, Close 20140919,394 20140920,408 20140921,398 20140922,402 20140923,435 20140924,423 20140925,411 20140926,404 20140927,399 20140928,377 20140929,375 20140930,386 20141001,383 20141002,375 20141003,359 20141004,328 20141005,320 20141006,330 20141007,336 20141008,352 20141009,365 20141010,361 20141011,362 20141012,378 20141013,390 20141014,400 20141015,394 20141016,382 20141017,383 20141018,391 20141019,389 20141020,382 20141021,386 20141022,383 20141023,358 20141024,358 20141025,347 20141026,354 20141027,352 20141028,357 20141029,335 20141030,345 20141031,338 20141101,325 20141102,325 20141103,327 20141104,330 20141105,339 20141106,349 20141107,342 20141108,345 20141109,363 20141110,366 20141111,367 20141112,423 20141113,420 20141114,397 20141115,376 20141116,387 20141117,387 20141118,375 20141119,380 20141120,357 20141121,350 20141122,352 20141123,367 20141124,376 20141125,375 20141126,368 20141127,369 20141128,376 20141129,375 20141130,378 20141201,379 20141202,381 20141203,375 20141204,369 20141205,376 20141206,374 20141207,375 20141208,361 20141209,352 20141210,346 20141211,350 20141212,352 20141213,347 20141214,351 20141215,345 20141216,327 20141217,319 20141218,311 20141219,317 20141220,329 20141221,320 20141222,331 20141223,334 20141224,322 20141225,319 20141226,327 20141227,315 20141228,317 20141229,312 20141230,310 20141231,320 20150101,314 20150102,315 20150103,281 20150104,264 20150105,274 20150106,286 20150107,294 20150108,283 20150109,290 20150110,274 20150111,265 20150112,267 20150113,225 20150114,178 20150115,209 20150116,208 20150117,199 20150118,210 20150119,214 20150120,211 20150121,226 20150122,233 20150123,232 20150124,247 20150125,253 20150126,273 20150127,263 20150128,233 20150129,233 20150130,226 20150131,217 20150201,226 20150202,238 20150203,227 20150204,226 20150205,217 20150206,222 20150207,227 20150208,223 20150209,220 20150210,219 20150211,219 20150212,221 20150213,235 20150214,257 20150215,234 20150216,233 20150217,243 20150218,236 20150219,240 20150220,243 20150221,244 20150222,235 20150223,238 20150224,238 20150225,237 20150226,236 20150227,253 20150228,254 20150301,260 20150302,275 20150303,281 20150304,273 20150305,276 20150306,272 20150307,276 20150308,274 20150309,289 20150310,291 20150311,296 20150312,294 20150313,285 20150314,281 20150315,286 20150316,290 20150317,285 20150318,256 20150319,260 20150320,261 20150321,260 20150322,267 20150323,266 20150324,245 20150325,246 20150326,248 20150327,247 20150328,252 20150329,242 20150330,247 20150331,244 20150401,247 20150402,253 20150403,254 20150404,253 20150405,260 20150406,255 20150407,253 20150408,245 20150409,243 20150410,236 20150411,236 20150412,236 20150413,224 20150414,219 20150415,223 20150416,228 20150417,222 20150418,223 20150419,222 20150420,224 20150421,235 20150422,234 20150423,236 20150424,231 20150425,226 20150426,219 20150427,229 20150428,225 20150429,225 20150430,236 20150501,232 20150502,234 20150503,240 20150504,239 20150505,236 20150506,229 20150507,237 20150508,243 20150509,241 20150510,240 20150511,242 20150512,241 20150513,236 20150514,236 20150515,237 20150516,236 20150517,236 20150518,233 20150519,231 20150520,234 20150521,235 20150522,240 20150523,238 20150524,240 20150525,237 20150526,237 20150527,237 20150528,237 20150529,237 20150530,233 20150531,230 20150601,222 20150602,225 20150603,225 20150604,224 20150605,224 20150606,225 20150607,222 20150608,228 20150609,229 20150610,228 20150611,229 20150612,229 20150613,232 20150614,233 20150615,236 20150616,250 20150617,249 20150618,249 20150619,244 20150620,245 20150621,243 20150622,246 20150623,244 20150624,240 20150625,242 20150626,243 20150627,250 20150628,249 20150629,257 20150630,263 20150701,258 20150702,255 20150703,256 20150704,260 20150705,271 20150706,269 20150707,266 20150708,270 20150709,269 20150710,284 20150711,293 20150712,310 20150713,292 20150714,287 20150715,285 20150716,278 20150717,279 20150718,274 20150719,273 20150720,278 20150721,275 20150722,277 20150723,276 20150724,288 20150725,288 20150726,292 20150727,293 20150728,294 20150729,289 20150730,287 20150731,284 20150801,281 20150802,282 20150803,281 20150804,285 20150805,281 20150806,278 20150807,279 20150808,260 20150809,265 20150810,264 20150811,270 20150812,266 20150813,264 20150814,265 20150815,261 20150816,258 20150817,257 20150818,211 20150819,226 20150820,235 20150821,232 20150822,230 20150823,228 20150824,210 20150825,221 20150826,225 20150827,224 20150828,231 20150829,229 20150830,228 20150831,230 20150901,228 20150902,229 20150903,227 20150904,230 20150905,235 20150906,239 20150907,239 20150908,243 20150909,238 20150910,238 20150911,240 20150912,235 20150913,230 20150914,230 20150915,230 20150916,229 20150917,229 20150918,232 20150919,231 20150920,231 20150921,227 20150922,230 20150923,230 20150924,234 20150925,235 20150926,234 20150927,232 20150928,239 20150929,236 20150930,236 20151001,237 20151002,237 20151003,238 20151004,238 20151005,240 20151006,246 20151007,242 20151008,242 20151009,243 20151010,244 20151011,247 20151012,245 20151013,249 20151014,251 20151015,254 20151016,262 20151017,270 20151018,261 20151019,263 20151020,269 20151021,266 20151022,274 20151023,276 20151024,281 20151025,283 20151026,285 20151027,293 20151028,304 20151029,313 20151030,328 20151031,314 20151101,325 20151102,361 20151103,403 20151104,411 20151105,386 20151106,374 20151107,386 20151108,373 20151109,380 20151110,336 20151111,311 20151112,338 20151113,336 20151114,332 20151115,320 20151116,330 20151117,335 20151118,334 20151119,326 20151120,322 20151121,326 20151122,324 20151123,323 20151124,320 20151125,328 20151126,352 20151127,358 20151128,357 20151129,371 20151130,377 20151201,362 20151202,359 20151203,361 20151204,363 20151205,388 20151206,388 20151207,395 20151208,415 20151209,417 20151210,415 20151211,451 20151212,434 20151213,433 20151214,444 20151215,465 20151216,454 20151217,456 20151218,463 20151219,462 20151220,442 20151221,438 20151222,436 20151223,442 20151224,454 20151225,455 20151226,417 20151227,422 20151228,422 20151229,432 20151230,426 20151231,430 20160101,434 20160102,433 20160103,430 20160104,433 20160105,431 20160106,429 20160107,458 20160108,453 20160109,447 20160110,447 20160111,448 20160112,435 20160113,432 20160114,430 20160115,364 20160116,387 20160117,382 20160118,387 20160119,380 20160120,420 20160121,410 20160122,382 20160123,387 20160124,402 20160125,391 20160126,392 20160127,394 20160128,380 20160129,379 20160130,378 20160131,368 20160201,373 20160202,374 20160203,369 20160204,389 20160205,386 20160206,376 20160207,376 20160208,373 20160209,376 20160210,381 20160211,379 20160212,384 20160213,391 20160214,407 20160215,400 20160216,407 20160217,416 20160218,422 20160219,420 20160220,437 20160221,438 20160222,437 20160223,420 20160224,424 20160225,424 20160226,432 20160227,432 20160228,433 20160229,437 20160301,435 20160302,423 20160303,421 20160304,410 20160305,400 20160306,407 20160307,414 20160308,413 20160309,414 20160310,417 20160311,421 20160312,411 20160313,414 20160314,416 20160315,416 20160316,417 20160317,420 20160318,409 20160319,410 20160320,413 20160321,413 20160322,418 20160323,418 20160324,416 20160325,417 20160326,417 20160327,426 20160328,424 20160329,416 20160330,414 20160331,416 20160401,417 20160402,420 20160403,420 20160404,421 20160405,424 20160406,423 20160407,422 20160408,420 20160409,419 20160410,421 20160411,422 20160412,425 20160413,423 20160414,424 20160415,429 20160416,430 20160417,427 20160418,428 20160419,435 20160420,441 20160421,449 20160422,445 20160423,450 20160424,458 20160425,461 20160426,466 20160427,444 20160428,449 20160429,455 20160430,448 20160501,451 20160502,444 20160503,450 20160504,446 20160505,447 20160506,459 20160507,458 20160508,458 20160509,460 20160510,450 20160511,452 20160512,454 20160513,455 20160514,455 20160515,457 20160516,454 20160517,453 20160518,454 20160519,438 20160520,442 20160521,443 20160522,439 20160523,444 20160524,445 20160525,449 20160526,453 20160527,473 20160528,530 20160529,526 20160530,533 20160531,531 20160601,536 20160602,537 20160603,569 20160604,572 20160605,574 20160606,585 20160607,576 20160608,581 20160609,574 20160610,577 20160611,606 20160612,672 20160613,704 20160614,685 20160615,694 20160616,766 20160617,748 20160618,756 20160619,763 20160620,737 20160621,666 20160622,596 20160623,623 20160624,665 20160625,665 20160626,629 20160627,655 20160628,647 20160629,639 20160630,673 20160701,676 20160702,703 20160703,658 20160704,683 20160705,670 20160706,677 20160707,640 20160708,666 20160709,650 20160710,649 20160711,647 20160712,664 20160713,654 20160714,658 20160715,663 20160716,660 20160717,679 20160718,673 20160719,672 20160720,665 20160721,665 20160722,650 20160723,655 20160724,661 20160725,654 20160726,651 20160727,654 20160728,655 20160729,656 20160730,655 20160731,624 20160801,606 20160802,547 20160803,566 20160804,578 20160805,575 20160806,587 20160807,592 20160808,591 20160809,587 20160810,592 20160811,589 20160812,587 20160813,585 20160814,570 20160815,567 20160816,577 20160817,573 20160818,574 20160819,575 20160820,581 20160821,581 20160822,586 20160823,583 20160824,580 20160825,577 20160826,579 20160827,569 20160828,573 20160829,574 20160830,577 20160831,575 20160901,572 20160902,575 20160903,598 20160904,608 20160905,606 20160906,610 20160907,614 20160908,626 20160909,622 20160910,623 20160911,606 20160912,608 20160913,609 20160914,610 20160915,607 20160916,606 20160917,605 20160918,609 20160919,609 20160920,608 20160921,597 20160922,596 20160923,602 20160924,602 20160925,600 20160926,608 20160927,606 20160928,604 20160929,605 20160930,609 20161001,613 20161002,610 20161003,612 20161004,610 20161005,612 20161006,613 20161007,617 20161008,619 20161009,616 20161010,618 20161011,641 20161012,636 20161013,636 20161014,640 20161015,638 20161016,641 20161017,639 20161018,637 20161019,630 20161020,630 20161021,632 20161022,657 20161023,657 20161024,653 20161025,657 20161026,678 20161027,688 20161028,689 20161029,714 20161030,701 20161031,700 20161101,729 20161102,740 20161103,688 20161104,703 20161105,703 20161106,711 20161107,703 20161108,709 20161109,723 20161110,715 20161111,716 20161112,705 20161113,702 20161114,705 20161115,711 20161116,744 20161117,740 20161118,751 20161119,751 20161120,731 20161121,739 20161122,751 20161123,744 20161124,740 20161125,741 20161126,735 20161127,732 20161128,735 20161129,735 20161130,745 20161201,756 20161202,777 20161203,771 20161204,773 20161205,758 20161206,764 20161207,768 20161208,770 20161209,772 20161210,774 20161211,769 20161212,780 20161213,780 20161214,781 20161215,778 20161216,784 20161217,790 20161218,790 20161219,792 20161220,800 20161221,834 20161222,864 20161223,921 20161224,898 20161225,896 20161226,907 20161227,933 20161228,975 20161229,973 20161230,961 20161231,963 20170101,998 20170102,1021 20170103,1043 20170104,1154 20170105,1013 20170106,902 20170107,908 20170108,911 20170109,902 20170110,907 20170111,777 20170112,804 20170113,823 20170114,818 20170115,821 20170116,831 20170117,907 20170118,886 20170119,899 20170120,895 20170121,921 20170122,924 20170123,921 20170124,892 20170125,901 20170126,917 20170127,919 20170128,921 20170129,919 20170130,920 20170131,970 20170201,989 20170202,1011 20170203,1029 20170204,1042 20170205,1027 20170206,1038 20170207,1061 20170208,1063 20170209,994 20170210,988 20170211,1004 20170212,999 20170213,990 20170214,1004 20170215,1007 20170216,1027 20170217,1046 20170218,1054 20170219,1047 20170220,1079 20170221,1115 20170222,1117 20170223,1166 20170224,1173 20170225,1143 20170226,1165 20170227,1179 20170228,1179 20170301,1222 20170302,1251 20170303,1274 20170304,1255 20170305,1267 20170306,1272 20170307,1223 20170308,1150 20170309,1188 20170310,1116 20170311,1175 20170312,1221 20170313,1231 20170314,1240 20170315,1249 20170316,1187 20170317,1100 20170318,973 20170319,1036 20170320,1054 20170321,1120 20170322,1049 20170323,1038 20170324,937 20170325,972 20170326,966 20170327,1045 20170328,1047 20170329,1039 20170330,1026 20170331,1071 20170401,1080 20170402,1102 20170403,1143 20170404,1133 20170405,1124 20170406,1182 20170407,1176 20170408,1175 20170409,1187 20170410,1187 20170411,1205 20170412,1200 20170413,1169 20170414,1167 20170415,1172 20170416,1182 20170417,1193 20170418,1211 20170419,1210 20170420,1229 20170421,1222 20170422,1231 20170423,1207 20170424,1250 20170425,1265 20170426,1281 20170427,1317 20170428,1316 20170429,1321 20170430,1347 20170501,1421 20170502,1452 20170503,1490 20170504,1537 20170505,1555 20170506,1578 20170507,1596 20170508,1723 20170509,1755 20170510,1787 20170511,1848 20170512,1724 20170513,1804 20170514,1808 20170515,1738 20170516,1734 20170517,1839 20170518,1888 20170519,1987 20170520,2084 20170521,2041 20170522,2173 20170523,2320 20170524,2443 20170525,2304 20170526,2202 20170527,2038 20170528,2155 20170529,2255 20170530,2175 20170531,2286 20170601,2407 20170602,2488 20170603,2515 20170604,2511 20170605,2686 20170606,2863 20170607,2732 20170608,2805 20170609,2823 20170610,2947 20170611,2958 20170612,2659 20170613,2717 20170614,2506 20170615,2464 20170616,2518 20170617,2655 20170618,2548 20170619,2589 20170620,2721 20170621,2689 20170622,2705 20170623,2744 20170624,2608 20170625,2589 20170626,2478 20170627,2552 20170628,2574 20170629,2539 20170630,2480 20170701,2434 20170702,2506 20170703,2564 20170704,2601 20170705,2601 20170706,2608 20170707,2518 20170708,2571 20170709,2518 20170710,2372 20170711,2337 20170712,2398 20170713,2357 20170714,2233 20170715,1998 20170716,1929 20170717,2228 20170718,2318 20170719,2273 20170720,2817 20170721,2667 20170722,2810 20170723,2730 20170724,2754 20170725,2576 20170726,2529 20170727,2671 20170728,2809 20170729,2726 20170730,2757 20170731,2875 20170801,2718 20170802,2710 20170803,2804 20170804,2895 20170805,3252 20170806,3213 20170807,3378 20170808,3419 20170809,3342 20170810,3381 20170811,3650 20170812,3884 20170813,4073 20170814,4325 20170815,4181 20170816,4376 20170817,4331 20170818,4160 20170819,4193 20170820,4087 20170821,4001 20170822,4100 20170823,4151 20170824,4334 20170825,4371 20170826,4352 20170827,4382 20170828,4382 20170829,4579 20170830,4565 20170831,4703 20170901,4892 20170902,4578 20170903,4582 20170904,4236 20170905,4376 20170906,4597 20170907,4599 20170908,4228 20170909,4226 20170910,4122 20170911,4161 20170912,4130 20170913,3882 20170914,3154 20170915,3637 20170916,3625 20170917,3582 20170918,4065 20170919,3924 20170920,3905 20170921,3631 20170922,3630 20170923,3792 20170924,3682 20170925,3926 20170926,3892 20170927,4200 20170928,4174 20170929,4163 20170930,4338 20171001,4403 20171002,4409 20171003,4317 20171004,4229 20171005,4328 20171006,4370 20171007,4426 20171008,4610 20171009,4772 20171010,4781 20171011,4826 20171012,5446 20171013,5647 20171014,5831 20171015,5678 20171016,5725 20171017,5605 20171018,5590 20171019,5708 20171020,6011 20171021,6031 20171022,6008 20171023,5930 20171024,5526 20171025,5750 20171026,5904 20171027,5780 20171028,5753 20171029,6153 20171030,6130 20171031,6468 20171101,6767 20171102,7078 20171103,7207 20171104,7379 20171105,7407 20171106,7022 20171107,7144 20171108,7459 20171109,7143 20171110,6618 20171111,6357 20171112,5950 20171113,6559 20171114,6635 20171115,7315 20171116,7871 20171117,7708 20171118,7790 20171119,8036 20171120,8200 20171121,8071 20171122,8253 20171123,8038 20171124,8253 20171125,8790 20171126,9330 20171127,9818 20171128,10058 20171129,9888 20171130,10233 20171201,10975 20171202,11074 20171203,11323 20171204,11657 20171205,11916 20171206,14291 20171207,17899 20171208,16569 20171209,15178 20171210,15455 20171211,16936 20171212,17415 20171213,16408 20171214,16564 20171215,17706 20171216,19497 20171217,19140 20171218,19114 20171219,17776 20171220,16624 20171221,15802 20171222,13831 20171223,14699 20171224,13925 20171225,14026 20171226,16099 20171227,15838 20171228,14606 20171229,14656 20171230,12952 20171231,14156 20180101,13657 20180102,14982 20180103,15201 20180104,15599 20180105,17429 20180106,17527 20180107,16477 20180108,15170 20180109,14595 20180110,14973 20180111,13405 20180112,13980 20180113,14360 20180114,13772 20180115,13819 20180116,11490 20180117,11188 20180118,11474 20180119,11607 20180120,12899 20180121,11600 20180122,10931 20180123,10868 20180124,11359 20180125,11259 20180126,11171 20180127,11440 20180128,11786 20180129,11296 20180130,10106 20180131,10221 20180201,9170 20180202,8830 20180203,9174 20180204,8277 20180205,6955 20180206,7754 20180207,7621 20180208,8265 20180209,8736 20180210,8621 20180211,8129 20180212,8926 20180213,8598 20180214,9494 20180215,10166 20180216,10233 20180217,11112 20180218,10551 20180219,11225 20180220,11403 20180221,10690 20180222,10005 20180223,10301 20180224,9813 20180225,9664 20180226,10366 20180227,10725 20180228,10397 20180301,10951 20180302,11086 20180303,11489 20180304,11512 20180305,11573 20180306,10779 20180307,9965 20180308,9395 20180309,9337 20180310,8866 20180311,9578 20180312,9205 20180313,9194 20180314,8269 20180315,8300 20180316,8338 20180317,7916 20180318,8223 20180319,8630 20180320,8913 20180321,8929 20180322,8728 20180323,8879 20180324,8668 20180325,8495 20180326,8209 20180327,7833 20180328,7954 20180329,7165 20180330,6890 20180331,6973 20180401,6844 20180402,7083 20180403,7456 20180404,6853 20180405,6811 20180406,6636 20180407,6911 20180408,7023 20180409,6770 20180410,6834 20180411,6968 20180412,7889 20180413,7895 20180414,7986 20180415,8329 20180416,8058 20180417,7902 20180418,8163 20180419,8294 20180420,8845 20180421,8895 20180422,8802 20180423,8930 20180424,9697 20180425,8845 20180426,9281 20180427,8987 20180428,9348 20180429,9419 20180430,9240 20180501,9119 20180502,9235 20180503,9743 20180504,9700 20180505,9858 20180506,9654 20180507,9373 20180508,9234 20180509,9325 20180510,9043 20180511,8441
what is the problem????