# Value Error: MSLE & CrossVal

I'm trying to run cross validation with mean squared log error with sklearn and getting the following error message:

ValueError: Mean Squared Logarithmic Error cannot be used when targets contain negative values.


This would suggest that I have negative values in my 1d array y. However, I have tried about 10 different ways of checking, including importing into excel and I can see no negative values in there.

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_squared_log_error
import pandas as pd
import numpy as np

train_csv = 'train.csv'

# define variables
target = 'SalePrice'
indep_variable = 'OverallQual'

# scoring
scoring_cross_val = 'neg_mean_squared_log_error'
scoring = mean_squared_log_error

# initate model
lin_reg = LinearRegression()

# example data
X = df_train.drop(target, axis=1)
X = X[indep_variable].to_numpy().reshape(-1, 1)
y = df_train[target].to_numpy().reshape(-1, 1)

# fit model
lin_reg.fit(X, y)

# cross validated model error
cv = cross_val_score(lin_reg, X, y, cv=2, scoring=scoring_cross_val)



I created a version of the code above with some simple inputs to check it isn't a bug in my version of sklearn. The code runs without a problem.

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
from sklearn.metrics import mean_squared_log_error
import pandas as pd
import numpy as np

# scoring
scoring_cross_val = 'neg_mean_squared_log_error'
scoring = mean_squared_log_error

# initate model
lin_reg = LinearRegression()

# example data
X = np.array([1.,2.,3.]).reshape(-1, 1)
y = np.array([4.,5.,6.]).reshape(-1, 1)

# fit model
lin_reg.fit(X, y)

# cross validated model error
cv = cross_val_score(lin_reg, X, y, cv=2, scoring=scoring_cross_val)