How to Count the World's Ports by Ocean and Sea

On this page

Problem statement

Which oceans and seas have the most ports? The World Port Index's World Water Body column names the water each port lies on, as a chain from the most local water to the ocean: "Gulf of Finland; Baltic Sea; North Atlantic Ocean". Grouping on the whole string splits the same ocean into dozens of groups, and grouping on the first item mixes gulfs with oceans. This page counts ports by the most local water body and by the ocean at the end of the chain, finds where the large ports are, and checks the IHO sea area column that should do the same job.

Quick answer

Take the first water body in each chain and count the ports:

wb = ports["World Water Body"].str.split(";").str[0].str.strip()
print(wb.value_counts().head(10).to_string())
print(f"water bodies: {wb.nunique()}; ports listing more than one: {ports['World Water Body'].str.contains(';', na=False).sum()}")
World Water Body
North Atlantic Ocean            470
North Pacific Ocean             228
Caribbean Sea                   162
Mediterranean Sea               158
North Sea                       155
Alaska-Canada coastal waters    125
South Pacific Ocean             116
South Atlantic Ocean            112
Baltic Sea                      109
Sea of Japan                    105
water bodies: 136; ports listing more than one: 2808

By the first water body, the North Atlantic has the most ports, 470, then the North Pacific with 228, the Caribbean 162, the Mediterranean 158, the North Sea 155 and the Alaska-Canada coastal waters 125. There are 136 different water bodies, and 2,808 ports list more than one: the column is a hierarchy, not a single value.

Horizontal bars of ports by the most local water body: North Atlantic Ocean 470, North Pacific 228, Caribbean 162, Mediterranean 158, North Sea 155. Horizontal bars of ports by the most local water body: North Atlantic Ocean 470, North Pacific 228, Caribbean 162, Mediterranean 158, North Sea 155.
Ports by sea.

Oceans, large ports and IHO areas

1. Oceans from seas

chain = ports["World Water Body"].str.split(";").apply(lambda l: [x.strip() for x in l] if isinstance(l, list) else [])
ports["ocean"] = chain.str[-1]                                    # the list runs from the most local water to the ocean
print(chain.str.len().value_counts().sort_index().to_dict())
print(ports.ocean.value_counts().head(8).to_string())
{1: 999, 2: 2319, 3: 489}
ocean
North Atlantic Ocean    1939
North Pacific Ocean      833
Indian Ocean             338
South Pacific Ocean      264
Great Lakes              232
South Atlantic Ocean     144
Arctic Ocean              57

999 ports list one water body, 2,319 two and 489 three. The last item is the ocean, or the Great Lakes for ports on them. By it, the North Atlantic has 1,939 ports, half the index, the North Pacific 833, the Indian Ocean 338, the South Pacific 264, the Great Lakes 232, the South Atlantic 144 and the Arctic 57. The Atlantic's share comes from Europe's and North America's many small harbours.

2. Large ports by water body

lg = ports[ports["Harbor Size"].isin(["Large", "Medium"])]
print(wb[lg.index].value_counts().head(8).to_string())
World Water Body
North Atlantic Ocean    59
North Sea               35
Mediterranean Sea       32
North Pacific Ocean     25
Caribbean Sea           25
Sea of Japan            23
Baltic Sea              19
South Atlantic Ocean    16

Medium and large ports are on the same waters as the others, but in a different order: the North Atlantic coast itself has 59, the North Sea 35, the Mediterranean 32, then the North Pacific and the Caribbean with 25 each and the Sea of Japan with 23.

Horizontal bars of ports by the ocean at the end of the water body chain: North Atlantic 1,939, North Pacific 833, Indian 338, South Pacific 264, Great Lakes 232. Horizontal bars of ports by the ocean at the end of the water body chain: North Atlantic 1,939, North Pacific 833, Indian 338, South Pacific 264, Great Lakes 232.
Ports by ocean.

3. The IHO sea areas

print(f"IHO S-130 sea area given: {ports['IHO S-130 Sea Area'].notna().sum():,} of {len(ports):,}")
print(ports["IHO S-130 Sea Area"].value_counts().head(6).to_dict())
IHO S-130 sea area given: 0 of 3,807
{}

The IHO S-130 Sea Area column, meant to give each port's sea under the International Hydrographic Organization's standard list, is empty for all 3,807 ports. The water body chain is the only sea information in the file.

Large ports' share by sea

The data used on this page

The US National Geospatial-Intelligence Agency's World Port Index (Pub. 150), the CSV served by its Maritime Safety Information site, downloaded on 28 October 2026 and saved on this site, because NGA revises the index as port information changes. A US government publication, free to use. Depths and lengths are in metres.

from pathlib import Path
import zipfile

import geopandas as gpd
import numpy as np
import pandas as pd
import requests

Path("data").mkdir(exist_ok=True)
# NGA's World Port Index (Pub. 150) as CSV, with Natural Earth's populated places, countries and land. Saved
# 28 October 2026: NGA revises the index as port information changes.
# Live: https://msi.nga.mil/api/publications/download?type=view&key=16920959/SFH00000/UpdatedPub150.csv
ARCHIVE = "nga-world-port-index-2026-10-28.zip"
if not Path(f"data/{ARCHIVE}").exists():
    Path(f"data/{ARCHIVE}").write_bytes(requests.get(f"https://data.spatialworkflow.io/{ARCHIVE}", timeout=600).content)
Z = zipfile.ZipFile(f"data/{ARCHIVE}")
for f in ["ne_10m_populated_places_simple.zip", "ne_110m_admin_0_countries.zip", "ne_50m_land.zip"]:
    Path(f"data/{f}").write_bytes(Z.read(f))
wpi = pd.read_csv(Z.open("UpdatedPub150.csv"), encoding="utf-8-sig")
wpi = wpi.replace(r"^\s*$", np.nan, regex=True)                                  # blank cells are a single space
DEPTHS = [c for c in wpi.columns if c.endswith("(m)")]
wpi[DEPTHS] = wpi[DEPTHS].where(wpi[DEPTHS] > 0)                                    # 0 means not recorded
ports = gpd.GeoDataFrame(wpi, geometry=gpd.points_from_xy(wpi.Longitude, wpi.Latitude), crs=4326)
print(f"World Port Index: {len(ports):,} ports in {ports['Country Code'].nunique()} countries and territories")
World Port Index: 3,807 ports in 195 countries and territories

Example 1: ports per sea against the sea's coastline

r = ports.groupby(wb).agg(ports=("Main Port Name", "size"), large=("Harbor Size", lambda s: s.isin(["Large", "Medium"]).mean()))
print(r[r.ports >= 50].sort_values("large", ascending=False).round(3).head(8).to_string())
                   ports  large
World Water Body               
Persian Gulf          62  0.242
North Sea            155  0.226
Sea of Japan         105  0.219
Indian Ocean          71  0.211
South China Sea       62  0.210
Mediterranean Sea    158  0.203
Gulf of Bothnia       61  0.197
Gulf of Mexico        76  0.184

Among seas with 50 or more ports, the Persian Gulf has the largest share of medium and large ports, 24.2%, then the North Sea, the Sea of Japan, the Indian Ocean coast and the South China Sea, all above 20%. These are the seas of oil, industry and container trade, where most ports are built for ocean-going ships.

Horizontal bars of the share of medium and large ports by sea: Persian Gulf 24.2%, North Sea 22.6%, Sea of Japan 21.9%, Indian Ocean 21.1%. Horizontal bars of the share of medium and large ports by sea: Persian Gulf 24.2%, North Sea 22.6%, Sea of Japan 21.9%, Indian Ocean 21.1%.
Where the big ports are.