<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; sparse.hstack( [] )
Traceback (most recent call last):

  File &quot;&lt;ipython-input-143-f5f1847514fe&gt;&quot;, line 1, in &lt;module&gt;
    sparse.hstack( [] )

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 423, in hstack
    return bmat([blocks], format=format, dtype=dtype)

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 533, in bmat
    raise ValueError('blocks[%d,:] is all None' % brow_lengths.argmin())

ValueError: blocks[0,:] is all None


&gt;&gt;&gt; sparse.vstack( [] )
Traceback (most recent call last):

  File &quot;&lt;ipython-input-144-de4027ae6d92&gt;&quot;, line 1, in &lt;module&gt;
    sparse.vstack( [] )

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 454, in vstack
    return bmat([[b] for b in blocks], format=format, dtype=dtype)

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 503, in bmat
    raise ValueError('blocks must have rank 2')

ValueError: blocks must have rank 2"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; sparse.hstack( [] )
Traceback (most recent call last):

  File "&lt;ipython-input-143-f5f1847514fe&gt;", line 1, in &lt;module&gt;
    sparse.hstack( [] )

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 423, in hstack
    return bmat([blocks], format=format, dtype=dtype)

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 533, in bmat
    raise ValueError('blocks[%d,:] is all None' % brow_lengths.argmin())

ValueError: blocks[0,:] is all None


&gt;&gt;&gt; sparse.vstack( [] )
Traceback (most recent call last):

  File "&lt;ipython-input-144-de4027ae6d92&gt;", line 1, in &lt;module&gt;
    sparse.vstack( [] )

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 454, in vstack
    return bmat([[b] for b in blocks], format=format, dtype=dtype)

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 503, in bmat
    raise ValueError('blocks must have rank 2')

ValueError: blocks must have rank 2
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; from scipy import sparse
&gt;&gt;&gt; sparse.hstack( (sparse.csr_matrix([[1,2]]), np.array([[]])) )
Traceback (most recent call last):

  File &quot;&lt;ipython-input-27-f65b402ca75d&gt;&quot;, line 1, in &lt;module&gt;
    hstack( (csr_matrix([[1,2]]), np.array([[]])) )

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 423, in hstack
    return bmat([blocks], format=format, dtype=dtype)

  File &quot;C:\Python27\lib\site-packages\scipy\sparse\construct.py&quot;, line 535, in bmat
    raise ValueError('blocks[:,%d] is all None' % bcol_lengths.argmin())

ValueError: blocks[:,1] is all None"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; from scipy import sparse
&gt;&gt;&gt; sparse.hstack( (sparse.csr_matrix([[1,2]]), np.array([[]])) )
Traceback (most recent call last):

  File "&lt;ipython-input-27-f65b402ca75d&gt;", line 1, in &lt;module&gt;
    hstack( (csr_matrix([[1,2]]), np.array([[]])) )

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 423, in hstack
    return bmat([blocks], format=format, dtype=dtype)

  File "C:\Python27\lib\site-packages\scipy\sparse\construct.py", line 535, in bmat
    raise ValueError('blocks[:,%d] is all None' % bcol_lengths.argmin())

ValueError: blocks[:,1] is all None
</code></pre></div>
<p dir="auto">The same error occurs with all sparse matrix formats and with vstack.</p>