What is the role of keepdims in Numpy (Python)?
<p>When I use <code>np.sum</code>, I encountered a parameter called <code>keepdims</code>. After looking up <a href="https://docs.scipy.org/doc/numpy-1.10.1/reference/generated/numpy.sum.html" rel="noreferrer">the docs</a>, I still cannot understand the meaning of <code>keepdims</code>.</p>
<blockquote>
<p><code>keepdims</code>: bool, optional</p>
<p>If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.</p>
</blockquote>
<p>I will appreciate it if anyone can make some sense of this with a simple example.</p>