Skip to content
Advertisement

Plotting average linear regression of data set consisting of missing values

JavaScript

I was trying to plot a linear graph using m,b = np.polyfit(x0, y0, 1) function however when I print m2,b2,m3,b3 I get nan. from the empty values. How do I fix this?

Advertisement

Answer

You seem to have a typo in

JavaScript

It would probably help to rename the variables idxy12,idxy13 and idxy14 or so.

You also could write all this with loops using zip, needing less copy-paste and making the code easier to change. (The goal is that each change should only happen at exact one spot):

JavaScript

fitting a line through points containing nans

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement