OneHotEncoder报错:无法将字符串转为浮点型,求解决方法
I'm currently learning Multiple Linear Regression and working through practice exercises. When I try to use OneHotEncoder to convert the payment_type column into categorical variables, I keep hitting this error:
OneHotEncoder Error: cannot convert string to float
I've tried several online troubleshooting solutions, but the error persists. What's really confusing me is that the error mentions failing to convert 'VTS'—not the payment_type column I'm actually trying to process. Up to this point, my code only includes basic data loading steps, no other transformations have been applied.
I've attached a screenshot of my current code and the error message for reference:
Code and error screenshot
Could anyone help me figure out why this error is occurring and how to resolve it?
内容的提问来源于stack exchange,提问作者ra1993

