df = pd.lreshape(df, {'QUEUE': df.columns[df.columns.str.startswith('QUEUE'
    )].tolist()})
piv_df = df.pivot_table(index=['QUEUE'], columns=['HOUR'], fill_value=0)
How to group rows and extract mean values