When I'm fitting sklearn
's LogisticRegression
using a 1 column python pandas
DataFrame
(not a Series
object), I get this warning:
/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)
I know I could easily advert this warning in my code, but how can I turn off these warnings?
As posted here,
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# Do stuff here
Thanks to Andreas above for posting the link.