def compute_errors(df, var, n):
    """Return an array containing the standard error of variable 'var' at each match for all account_ids in dataframe 'df' over 'n' matches"""
    matches = df.groupby('account_id', sort=False).head(n)
    errors = matches.groupby('nth_match')[var].sem()
    errors = errors.tolist()

    return errors