【发布时间】:2015-05-19 03:10:38
【问题描述】:
当我使用 1 列 python pandas DataFrame(不是 Series 对象)拟合 sklearn 的 LogisticRegression 时,我收到此警告:
/Library/Python/2.7/site-packages/sklearn/preprocessing/label.py:125:
DataConversionWarning: A column-vector y was passed when a 1d array was
expected. Please change the shape of y to (n_samples, ), for example using
ravel().
y = column_or_1d(y, warn=True)
我知道我可以很容易地在我的代码中宣传这个警告,但是我怎样才能关闭这些警告呢?
【问题讨论】:
-
您可以使用警告模块过滤警告:docs.python.org/2/library/warnings.html
标签: python pandas warnings scikit-learn