Relative Content

Tag Archive for python-3.xpandasgoogle-colaboratory

How to add a column on a Pandas DataFrame that is based on the continent a country is

What I wanted to do is basically add a column of for all 7 continents, and I want the continents to be assigned based on where the country is located. Adding the column is the easy part, all I have to do is make a dictionary and turn it into a column of said Pandas DataFrame, the hard part is getting it to assign said continents to the DataFrame, which I tried searching online but so far I haven’t found any solution.