I am learning data science and reading other people's scripts. There is this one titanic algorithm (kaggle) has this code to apply the Logistic Regression then supposedly export to a .csv file as suggested in the code. However, it always generates an error message after I run the code. The original script is found here, and the .csv data that's being read into the code is here: train.csv test.csv
From Input[24] to Input[28] are for setting up LogisticRegression. Up to Input[27] the code still runs without error. When running Input[28]:
acc_log = predict_model(X_data, Y_data, logreg, X_test_kaggle, 'submission_Logistic.csv')
I receive an error message:
ValueError: could not convert string to float: 'Q'
I tried to add "try/except" to bypass the error message so the code can continue.
try:
acc_log = predict_model(X_data, Y_data, logreg, X_test_kaggle, 'submission_Logistic.csv')
except ValueError:
pass
This code is a bit too sophisticated for me to debug to see which step goes wrong and where in the file that has the string in place of the desired input for a float. So I would like to ask for help here to better understand this and seek for a proper solution. Thanks.