I have a dataset df
that looks like this:
code
Germany
Italy
Germany
France
I want to create a new column
df['status']
and assign it values based on the code
column. Wherever, the code is Germany, I want to assign df['status']
the value "ON". Everywhere else, I want to write "OFF". How can I achieve this?
I some solutions using .apply()
but I read that there are slower, which is why I am looking for alternatives.