Reputation: 1
After performing OneHotEncoding, my data frame gives values for its columns as True and False, not as 1 and 0, what I am supposed to have. My code looks like this, where the data frame is ds and the categorical column name is "type":
pd.get_dummies(ds,columns = ["type"])
I'm trying to get a numeric result.
Upvotes: -2
Views: 39
Reputation: 158
bool_val = True
print(bool_val) # returns True
print(int(bool_val)) # returns 1
Upvotes: 0