03 · Trade Composition: What Does Bahrain Trade?¶
Objective. Quantify the size and composition of Bahrain's non-oil trade before the 2026 conflict: the split between imports, domestic exports and re-exports, and the commodity categories and products that dominate each flow.
Scope. Annual figures use complete years only (2021–2025). Including the nine-month 2026 in an annual average would bias it downward.
%load_ext autoreload
%autoreload 2
import pandas as pd
import plotly.express as px
from scripts.analysis import load_trade, full_years, to_millions
from scripts.plotly_theme import use_metro, RED, BLUE, ORANGE
use_metro()
pd.options.display.float_format = "{:,.1f}".format
TYPE_COLORS = {"import": RED, "export": BLUE, "re-export": ORANGE}
df = load_trade()
fy = full_years(df)
1. Annual trade volume¶
Three measures of size are reported: total declared value, total weight and number of records.
annual = fy.groupby("year").agg(
value_bhd_m=("price_bhd", "sum"),
weight_mt=("weight_kg", "sum"),
records=("price_bhd", "size"),
)
annual["value_bhd_m"] = annual["value_bhd_m"] / 1e6 # BHD millions
annual["weight_mt"] = annual["weight_mt"] / 1e9 # million tonnes
annual
# Average per complete year, and the bias introduced by including partial 2026
avg_full = annual.mean()
annual_with_2026 = df.groupby("year").agg(
value_bhd_m=("price_bhd", "sum"),
weight_mt=("weight_kg", "sum"),
records=("price_bhd", "size"),
)
annual_with_2026["value_bhd_m"] = annual_with_2026["value_bhd_m"] / 1e6
annual_with_2026["weight_mt"] = annual_with_2026["weight_mt"] / 1e9
avg_with_2026 = annual_with_2026.mean()
pd.DataFrame({"2021–2025 (complete years)": avg_full, "2021–2026 (incl. partial 2026)": avg_with_2026})
2. Composition by trade type¶
The share of each trade type depends on the measure: value, weight or number of records.
composition = fy.groupby("trade_type").agg(
value=("price_bhd", "sum"),
weight=("weight_kg", "sum"),
records=("price_bhd", "size"),
)
composition_pct = composition / composition.sum() * 100
composition_pct
temp = (
composition_pct
.reset_index()
.melt(id_vars="trade_type", var_name="measure", value_name="share")
)
fig = px.bar(
temp,
x="share",
y="measure",
color="trade_type",
orientation="h",
text_auto=".1f",
color_discrete_map=TYPE_COLORS,
)
fig.update_layout(
title="Trade Composition by Measure, 2021–2025",
xaxis_title="Share (%)",
yaxis_title="Measure",
legend_title_text="Trade Type",
barmode="stack",
height=420,
)
fig.show()
3. Commodity categories¶
Commodities are grouped into HS sections (see notebook 01). The chart compares the share of each category within imports and within domestic exports.
cat = (
fy[fy["trade_type"].isin(["import", "export"])]
.groupby(["trade_type", "commodity_category"], observed=True)["price_bhd"].sum()
.reset_index()
)
cat["share"] = cat["price_bhd"] / cat.groupby("trade_type")["price_bhd"].transform("sum") * 100
cat_wide = cat.pivot(index="commodity_category", columns="trade_type", values="share").fillna(0)
cat_wide.sort_values("import", ascending=False)
# order categories by their import share, largest at the top
order = cat_wide.sort_values("import", ascending=False).index.tolist()
fig = px.bar(
cat,
x="share",
y="commodity_category",
color="trade_type",
barmode="group",
orientation="h",
color_discrete_map=TYPE_COLORS,
category_orders={"commodity_category": order},
)
fig.update_layout(
title="Commodity Categories: Share of Import and Export Value, 2021–2025",
xaxis_title="Share of Trade-Type Value (%)",
yaxis_title="Category",
legend_title_text="Trade Type",
height=750,
)
fig.show()
4. Leading products¶
Individual 8-digit commodities ranked by total value. The concentration of value in a few products is examined in more detail in notebook 07.
def top_products(trade_type, n=10):
sub = fy[fy["trade_type"] == trade_type]
total = sub["price_bhd"].sum()
out = (
sub.groupby("commodity_name")["price_bhd"].sum().nlargest(n)
.rename("value_bhd_m").to_frame()
)
out["share_%"] = out["value_bhd_m"] / total * 100
out["value_bhd_m"] = to_millions(out["value_bhd_m"])
return out
top_imports = top_products("import")
top_imports
top_exports = top_products("export")
top_exports
top_reexports = top_products("re-export")
top_reexports
temp = top_imports.reset_index()
temp["commodity_name"] = temp["commodity_name"].str.title().str.slice(0, 45) # shorten long names
fig = px.bar(
temp,
x="value_bhd_m",
y="commodity_name",
orientation="h",
text_auto=".0f",
)
fig.update_layout(
title="Top 10 Imported Products by Value, 2021–2025",
xaxis_title="Value (BHD m)",
yaxis_title="Commodity",
)
fig.update_traces(marker_color=RED)
fig.update_yaxes(categoryorder="total ascending")
fig.show()
temp = top_exports.reset_index()
temp["commodity_name"] = temp["commodity_name"].str.title().str.slice(0, 45)
fig = px.bar(
temp,
x="value_bhd_m",
y="commodity_name",
orientation="h",
text_auto=".0f",
)
fig.update_layout(
title="Top 10 Exported Products by Value, 2021–2025",
xaxis_title="Value (BHD m)",
yaxis_title="Commodity",
)
fig.update_traces(marker_color=BLUE)
fig.update_yaxes(categoryorder="total ascending")
fig.show()
Stability of the leading imports over time¶
Annual value of the ten leading import products, to check whether the ranking reflects persistent dependence or isolated years.
top_names = top_imports.index
yearly = (
fy[(fy["trade_type"] == "import") & (fy["commodity_name"].isin(top_names))]
.pivot_table(index="commodity_name", columns="year", values="price_bhd", aggfunc="sum")
.reindex(top_names)
)
yearly = yearly / 1e6
yearly.index = yearly.index.str.title().str.slice(0, 40)
fig = px.imshow(
yearly,
text_auto=".0f",
aspect="auto",
title="Top 10 Import Products: Annual Value (BHD m)",
labels={
"x": "Year",
"y": "Commodity",
"color": "BHD m"
}
)
fig.update_xaxes(type="category")
fig.update_layout(height=650)
fig.show()
Findings¶
- Size. Over 2021–2025, Bahrain's non-oil trade averaged BHD 10.73 bn, 43.1 million tonnes and 381,315 records per year. Annual value ranged from BHD 9.99 bn (2021) to 11.53 bn (2022). Correction to the earlier deck: the figures on its slide 7 (BHD 9.99 bn, 38.6 Mt, 358,413 records) averaged in the nine-month 2026, which understates all three measures by 6–11%.
- Imports are the largest flow by every measure. They account for 54.1% of value, 62.0% of weight and 84.1% of records. Domestic exports contribute 38.9% of value, and re-exports 7.1% of value but only 0.7% of weight (high-value, low-weight goods).
- Imports are diversified across categories, exports are not. The three leading import categories are Machinery / Electrical (19.6%), Chemicals (15.8%) and Mineral Products (15.5%). Domestic exports are concentrated in Metals (58.5%), followed by Mineral Products (17.6%).
- A few industrial inputs dominate imports. Iron ore (11.4% of import value) and alumina (8.2%) alone make up about one fifth of all imports. Both are raw materials for Bahrain's main exports, aluminium alloys (28.9% of export value) and agglomerated iron ore pellets (17.4%). Import dependence and export capacity are therefore directly linked.
- The dependence is persistent. Iron ore and alumina are the two largest imports in every year from 2021 to 2025. Alumina imports rose from BHD 378 m to 558 m over the period. Smartphones have no 2021 value because their commodity code was introduced in the HS 2022 revision.