One Hot Encoding - Columns w/ Both Strings and Numbers

My CSV file has several columns with both the String “None” and float numbers.

Example:
ColA (header)
0.57
1.29
None
9.78
5.99
None
None
15.57

Is there a method of One Hot Encoding the columns so that only the parts with “None” are 1HEncoded, and the numbers stay as they are?

Thanks!

I think here you should just pass the number as is, and change the Nones to something constant and at the extremities of your data range. E.g a -1 or 0, but it depends on what you are trying to achieve.

1 Like

Yeah, I was thinking of this as an option but wasn’t sure if it might make the data inaccurate for some reason. Comforts me that another person has the same idea!

Thanks!