擅长:python、mysql、java
<p>我建议您查看是否有空值,在用pandas加载数据集后,请执行以下操作:</p>
<pre><code>dataset = dataset.dropna()
</code></pre>
<p>还要确保你的X值是数字,你可以使用描述数据集()或数据集.info():</p>
^{pr2}$
<p>你也可以尝试更新你的sklearn,在sklearn的某些版本中有一个已知的bug(我不记得是哪一个)</p>
<pre><code># if you are using conda
conda install scikit-learn
# if you are using pip
pip install -U scikit-learn
</code></pre>