title: Sklearn - plotting classification report gives a different output than basic avg?
body: <p>I wanted to leverage this answer <a href="https://stackoverflow.com/questions/28200786/how-to-plot-scikit-learn-classification-report">How to plot scikit learn classification report?</a> turning an sklearn classification report into a heatmap.</p>
  
  <p>It's all working with their sample report, however my classification report looks slightly different and is thus screwing up the functions. </p>
  
  <p>Their report (notice the avg / total):</p>
  
  <pre><code>sampleClassificationReport =             
                     precision    recall  f1-score   support
  
            Acacia        0.62      1.00      0.76        66
            Blossom       0.93      0.93      0.93        40
            Camellia      0.59      0.97      0.73        67
            Daisy         0.47      0.92      0.62       272
            Echium        1.00      0.16      0.28       413
  
          avg / total     0.77      0.57      0.49       858
  </code></pre>
  
  <p>My report with <code>metrics.classification_report(valid_y, y_pred)</code> :</p>
  
  <pre><code>              precision    recall  f1-score   support
  
             0       1.00      0.18      0.31        11
             1       0.00      0.00      0.00        14
             2       0.00      0.00      0.00        19
             3       0.50      0.77      0.61        66
             4       0.39      0.64      0.49        47
             5       0.00      0.00      0.00        23
  
      accuracy                           0.46       180
     macro avg       0.32      0.27      0.23       180
  weighted avg       0.35      0.46      0.37       180
  </code></pre>
  
  <p>The issue, from the selected answer in the heatmap link, is here:</p>
  
  <pre><code>for line in lines[2 : (len(lines) - 2)]:
      t = line.strip().split()
      if len(t) &lt; 2: continue
      classes.append(t[0])
      v = [float(x) for x in t[1: len(t) - 1]]
      support.append(int(t[-1]))
      class_names.append(t[0])
      print(v)
      plotMat.append(v)
  </code></pre>
  
  <p>Because I get the error: </p>
  
  <blockquote>
    <p>ValueError: could not convert string to float: 'avg'</p>
  </blockquote>
  
  <p>So the problem truly is how my classification report is being outputted. What can I change here to match the sample?</p>
  
  <p>EDIT: what Ive tried:</p>
  
  <pre><code>df = pd.DataFrame(metrics.classification_report(valid_y, y_pred)).T
  
  df['support'] = df.support.apply(int)
  
  df.style.background_gradient(cmap='viridis',
                               subset=pd.IndexSlice['0':'9', :'f1-score'])
  </code></pre>
  
  <p>Error: </p>
  
  <blockquote>
    <p>ValueError: DataFrame constructor not properly called!</p>
  </blockquote>