Hong kong
View or edit on GitHub
This page is synchronized from trase/models/brazil/customs_2019/hong_kong.ipynb. Last modified on 2025-12-14 23:19 CET by Trase Admin.
Please view or edit the original file there; changes should be reflected here after a midnight build (CET time),
or manually triggering it with a GitHub action (link).
from trase.tools import sps
df = sps.concat(
sps.get_pandas_df_once(
f"brazil/trade/mdic/disaggregated/brazil_mdic_disaggregated_{y}_beef.csv",
dtype=str,
).assign(year=y)
for y in [2019, 2020]
).astype({"vol": float})
df = df[df["country_of_destination.name"] == "CHINA (HONG KONG)"]
data = df.groupby(["year", "hs4", "success"])["vol"].sum().reset_index()
import plotly.express as px
px.bar(
data,
x="hs4",
y="vol",
color="success",
facet_row="year",
color_discrete_map={"True": "green", "False": "red"},
title="Success or failure of volume to Hong Kong",
)
sps.print_report_by_attribute(
df.assign(m=df["message"].str.slice(0, 50)), "vol", ["year", "hs4", "success", "m"]
)