'How to solve - ValueError: could not convert string to float: ''
training_age_in = [1, 2, 3]
training_salary_dep = [5, 9, 10]
m = [(training_age_in[0], training_salary_dep[0]), (training_age_in[1], training_salary_dep[1]),
(training_age_in[2], training_salary_dep[2])]
intercept_value = open("intercept_value", "r+")
slope_value = open("slope_value", "r+")
input_place = open("input_place", "r+")
intercept = float(intercept_value.read())
slope = float(slope_value.read())
input_place.seek(1)
input_place.write(str(training_age_in[0]))
number0 = float(input_place.read())
predicted_Y0 = intercept + (slope * number0)
error0 = (training_salary_dep[0] - predicted_Y0) ** 2
print(number0)
That's my code and it keeps coming up with a ValueError: could not convert string to float: ''. How could I solve this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|