Port Location Category

For this task, you will create a new categorical variable based on the two existing variables in the dataset: latitude and longitude. The goal is to assign the port location to one of four categories based on its position in the hemisphere: "Northern & Eastern Hemisphere", "Northern & Western Hemisphere", "Southern & Eastern Hemisphere" and "Southern & Western Hemisphere".

To achieve this, we recommend defining a function that given a row, return "NE", "NW", "SE", or "SW" based on the row's "LAT" and "LON" values. (Use conditional statements.)

You can use the .apply() method with axis set to 1 to apply a function on all rows of a dataframe.

Last updated