def aggregate_shares(df):
    """Compute share types by year and field."""
    return (df.groupby(["Year", "types", "field"]).size()
              .reset_index()
              .rename(columns={0: "count"}))