How to convert a column of string to numerical?
问题 I have this pandas dataframe from a query: | name | event | ---------------------------- | name_1 | event_1 | | name_1 | event_2 | | name_2 | event_1 | I need to convert the column event to numerical, or something to look like this: | name | event_1 | event_2 | ------------------------------- | name_1 | 1 | 0 | | name_1 | 0 | 1 | | name_2 | 1 | 0 | In the software rapidminer, i can do this with an operator "nominal to numerical", so i assume that in python convert the type of the column