Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+10 votes

Do we only use integers in colab? For example, do we need to change everything to integers or can it handle strings, booleans, etc?

closed with the note: answered
asked in CSC320 by (1 point)
closed by

1 Answer

+4 votes
Best answer

Sklearn needs everything to be a number (could be float instead of int though).

I think booleans might automatically convert to a 0/1, so you might not need to change those.

Strings will not work. (But you could use a label encoder in scikit learn to turn every string into a number, or make a separate column for each possible value of the string that you care about, with a 0/1 value representing whether that value is present.)

answered by (508 points)
selected by