title: Automatic reshape of seaborn.heatmap with available dataframe rows
body: <p>I have a dataframa as below:</p>
  <pre><code>       Symbol  Change  Yrows  Xcols
  0  ADANIPORTS    7.15      1      1
  1  BAJAJ-AUTO    3.04      1      2
  2  HINDUNILVR    3.00      1      3
  3         M&amp;M   -2.69      2      1
  4         UPL   -2.92      2      2
  5        NTPC   -3.15      2      3
  6    JSWSTEEL   -3.30      3      1
  7   COALINDIA   -3.38      3      2
  8        ONGC   -3.48      3      3
  </code></pre>
  <p>Here my Dataframe consists of 9 rows hence below code runs fine. But when dataframe size reduces to 8 it gives reshape error.</p>
  <p>I need help on below 2 conditions.</p>
  <ol>
  <li>I want to plot the heat map without that 9th row when not available.</li>
  <li>How to automatically reshape of HeatMap table with available data of dataframe.</li>
  </ol>
  <p>My Code as below:</p>
  <pre><code>df = pd.read_csv(&quot;Heatmap_data.csv&quot;)
  Yrows = [1,1,1,2,2,2,3,3,3]
  Xcols = [1,2,3,1,2,3,1,2,3]
  df = df.assign(Yrows=Yrows, Xcols=Xcols)
  
  symbol = ((np.asarray(df['Symbol'])).reshape(3, 3))
  perchange = ((np.asarray(df['Change'])).reshape(3, 3))
  
  result = df.pivot(index='Yrows', columns='Xcols', values='Change')
  labels = (np.asarray([&quot;{0} \n {1:.2f}%&quot;.format(symb, value) for symb, value in zip(symbol.flatten(), perchange.flatten())])).reshape(3, 3)
  
  fig, ax = plt.subplots(figsize=(13, 7))
  title = &quot;Heat Map&quot;
  plt.title(title, fontsize=18)
  ttl = ax.title
  ttl.set_position([0.5, 1.05])
  ax.set_xticks([])
  ax.set_yticks([])
  ax.axis('off')
  sns.heatmap(result, annot=labels, fmt=&quot;&quot;, cmap='RdYlGn', linewidths=0.40, ax=ax)
  plt.show()
  </code></pre>
  <p>I want my desired out put with dataframe of 8 rows as below:</p>
  <p><a href="https://i.stack.imgur.com/XxMm7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XxMm7.png" alt="output" /></a></p>