title: Python numpy shannon entropy array
body: <p>I have an Numpy array:</p>
  
  <pre><code> A = [ 1.56  1.47  1.31  1.16  1.11  1.14  1.06  1.12  1.19  1.06  0.92  0.78
         0.6   0.59  0.4   0.03  0.11  0.54  1.17  1.9   2.6   3.28  3.8   4.28
         4.71  4.61  4.6   4.41  3.88  3.46  3.04  2.63  2.3   1.75  1.24  1.14
         0.97  0.92  0.94  1.    1.15  1.33  1.37  1.48  1.53  1.45  1.32  1.08
         1.06  0.98  0.69]
  </code></pre>
  
  <p>How can I obtain the shannon entropy?</p>
  
  <p>I have seen it like this but not sure:</p>
  
  <pre><code>print -np.sum(A * np.log2(A), axis=1)
  </code></pre>