code: def reshape_bar_plot(df, x, y, bars):
      
      idx = [bars, x]
      if df.duplicated(idx).any():
          warnings.warn('Duplicated index found.')
          df = df.drop_duplicates(idx, keep='last')
      df = df.set_index(idx)[y].unstack(x).T
      return df
docs: Reshape data from long form to "bar plot form".
  
      Bar plot form has x value as the index with one column for bar grouping.
      Table values come from y values.