[Solved] country convert to continent


In the second snippet, you pass list of countries to country_to_continent function, which according to the first example, receives a single country as a parameter.

If you want to convert the whole column in your Dataframe, try instead:

print(df["country"].apply(lambda x: country_to_continent(x)))

solved country convert to continent