Failure rate

View or edit on GitHub

This page is synchronized from trase/models/brazil/customs_2019/failure_rate.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.sps import *
import pandas as pd


df = get_pandas_df(
    "brazil/trade/mdic/disaggregated/brazil_mdic_disaggregated_2020_beef.csv",
    dtype=str,
    na_filter=False,
).astype({"vol": float})

print_report_by_attribute(df, "vol", ["success"])

print_report_by_attribute(df[df["success"] == "False"], "vol", ["success", "message"])

print_report_by_attribute(
    df[df["success"] == "False"],
    "vol",
    ["success", "country_of_destination.name", "hs4"],
)
_1, _2, a = (
    df[df["country_of_destination.name"] == "CHINA (HONG KONG)"]["message"]
    .drop_duplicates()
    .values
)
print(a)