ValueError: could not convert string to float: 'Braund, Mr. Owen Harris'
时间: 2023-10-29 17:28:05 浏览: 303
ValueError: Could not find a format to read the specified file in mode ‘i’
This error occurs because the string 'Braund, Mr. Owen Harris' cannot be converted to a float data type. Float data types can only contain numerical values with decimal points.
To fix this error, you need to identify where in your code you are trying to convert a string to a float and either modify the string to contain only numerical values or use a different data type that can handle string values.
If you are working with a dataset that contains string values, you may need to use a different data type such as a string or an object to store the values. Alternatively, you may need to perform some data cleaning or preprocessing to remove non-numerical characters from the string values before converting them to floats.
阅读全文