def add_main_cat(df):
    """ Takes a df and adds a column with the main category
        input:
            df (pd.DataFrame): dataframe to add column to, must contain "cat_id"
        returns:
            df (pd.DataFrame): dataframe with extracted main cat
    """

    df["main_cat"] = df["cat_id"].astype(str).str.slice(0, 2)

    return df