## [Matplotlib-users] Polyfit

 [Matplotlib-users] Polyfit From: Jean-Baptiste Cazier - 2004-03-18 14:36:57 ```S=E6ll=20 One mroe question from me today :) I have some trouble running polyfit with matplotlib-0.52 Can you please help me finding out what I do wrong=20 I give a list of x values and y values as well as the degree of the desired= polynome. But all I get is the following error >>> x=3D[1,2,3] >>> y=3D[1,2,1] >>> polyfit(x,y,3) Traceback (most recent call last): File "<>", line 1, in ? File "/usr/lib/python2.2/site-packages/matplotlib/mlab.py", line 341, in = polyfit X =3D Matrix(vander(x, N+1)) File "/usr/lib/python2.2/site-packages/matplotlib/mlab.py", line 383, in = vander X =3D ones( (len(x),N), x.typecode()) AttributeError: 'list' object has no attribute 'typecode' Any idea ? Thanks Jean-Baptiste --=20 ----------------------------- Jean-Baptiste.Cazier@... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk ```

 [Matplotlib-users] Polyfit From: Jean-Baptiste Cazier - 2004-03-18 14:36:57 ```S=E6ll=20 One mroe question from me today :) I have some trouble running polyfit with matplotlib-0.52 Can you please help me finding out what I do wrong=20 I give a list of x values and y values as well as the degree of the desired= polynome. But all I get is the following error >>> x=3D[1,2,3] >>> y=3D[1,2,1] >>> polyfit(x,y,3) Traceback (most recent call last): File "<>", line 1, in ? File "/usr/lib/python2.2/site-packages/matplotlib/mlab.py", line 341, in = polyfit X =3D Matrix(vander(x, N+1)) File "/usr/lib/python2.2/site-packages/matplotlib/mlab.py", line 383, in = vander X =3D ones( (len(x),N), x.typecode()) AttributeError: 'list' object has no attribute 'typecode' Any idea ? Thanks Jean-Baptiste --=20 ----------------------------- Jean-Baptiste.Cazier@... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk ```
 Re: [Matplotlib-users] Polyfit From: John Hunter - 2004-03-18 23:31:36 ```>>>>> "Jean-Baptiste" == Jean-Baptiste Cazier writes: AttributeError: 'list' object has no attribute 'typecode' Hint: if you paste the error message into google and click "I'm Feeling Lucky", you'll get an answer to your question. But thanks for letting me know; I patched polyfit to convert lists to arrays with x = asarray(x) y = asarray(y) JDH ```