Binary encoding and its interpretation in Python
-
01-11-2019 - |
Question
I have a column named Street
that has 2 values: Paved and Gravel. Here is what print(train[binary_columns[0]].unique().tolist())
gives me:
['Pave', 'Grvl']
I want to encode these values in binary like this:
df['Street'] = df['Street'].replace(['Pave', 'Grvl'], [1, 0])
But I wonder if this is a good idea. Wouldn't the computer interpret this as Pave > Grvl
? How does the computer differentiate between binary and integer encoding?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange