def expand_gtf_attributes(df):
    """Extracts metadata from attributes and saves in new dataframe columns
    The following fields are parsed and provided as new columns:
    - gene_id
    - transcript_id
    - gene_name
    - appris_principal_score (float). Features without a principal score are
      assigned a score of 0
    """
    df["gene_id"] = df["attribute"].str.extract('gene_id "(.*?)";')
    df["transcript_id"] = df["attribute"].str.extract('transcript_id "(.*?)";')
    df["gene_name"] = df["attribute"].str.extract('gene_name "(.*?)";')
    df["appris_principal_score"] = (
        df["attribute"].str.extract('tag "appris_principal_(\d)";').astype(float)
    )
    df["appris_principal_score"] = df["appris_principal_score"].fillna(0)
    return df