Getting the regression line to plot from a Pandas regression

时间秒杀一切 提交于 2019-11-29 11:22:51

Check what values you have in your arrays and variables.

My guess is that your x is just nans, because you use Python's min and max. At least that happens with the version of Pandas that I have currently open.

The min and max methods should work, since they know how to handle nans or missing values

>>> x = pd.Series([np.nan,2], index=['const','slope'])
>>> x
const   NaN
slope     2
dtype: float64

>>> min(x)
nan
>>> max(x)
nan

>>> x.min()
2.0
>>> x.max()
2.0
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!