<p dir="auto">An error is raised when making a numpy array consisting of numpy arrays with ndim &gt; 1 with different sizes.</p>
<h3 dir="auto">Reproducing code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
b = np.array([np.array([[1],
    [1],
    [1]]), np.array([[1, 2],
    [1, 2],
    [1, 2]]), np.array([[1, 2, 3],
    [1, 2, 3],
    [1, 2, 3]]), np.array([[1, 2, 3, 4],
    [1, 2, 3, 4],
    [1, 2, 3, 4]])], dtype=object)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">1</span>],
    [<span class="pl-c1">1</span>],
    [<span class="pl-c1">1</span>]]), <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>]]), <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>]]), <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>],
    [<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>]])], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)</pre></div>
<h3 dir="auto">Error message:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ValueError: could not broadcast input array from shape (3,1) into shape (3,)"><pre class="notranslate"><code class="notranslate">ValueError: could not broadcast input array from shape (3,1) into shape (3,)
</code></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1.21.0 3.8.5 (default, Sep  4 2020, 07:30:14)
[GCC 7.3.0]"><pre class="notranslate"><code class="notranslate">1.21.0 3.8.5 (default, Sep  4 2020, 07:30:14)
[GCC 7.3.0]
</code></pre></div>
<p dir="auto">This behavior is a little confusing:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.asarray([np.zeros((10, 3)), np.zeros(10)])
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating 
ValueError: could not broadcast input array from shape (10,3) into shape (10)"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">asarray</span>([<span class="pl-s1">np</span>.<span class="pl-en">zeros</span>((<span class="pl-c1">10</span>, <span class="pl-c1">3</span>)), <span class="pl-s1">np</span>.<span class="pl-en">zeros</span>(<span class="pl-c1">10</span>)])
<span class="pl-v">VisibleDeprecationWarning</span>: <span class="pl-v">Creating</span> <span class="pl-s1">an</span> <span class="pl-s1">ndarray</span> <span class="pl-k">from</span> <span class="pl-s1">ragged</span> <span class="pl-s1">nested</span> <span class="pl-en">sequences</span> (<span class="pl-s1">which</span> <span class="pl-c1">is</span> <span class="pl-s1">a</span> <span class="pl-s1">list</span><span class="pl-c1">-</span><span class="pl-s1">or</span><span class="pl-c1">-</span><span class="pl-s1">tuple</span> <span class="pl-s1">of</span> <span class="pl-s1">lists</span><span class="pl-c1">-</span><span class="pl-s1">or</span><span class="pl-c1">-</span><span class="pl-s1">tuples</span><span class="pl-c1">-</span><span class="pl-s1">or</span> <span class="pl-s1">ndarrays</span> <span class="pl-k">with</span> <span class="pl-s1">different</span> <span class="pl-s1">lengths</span> <span class="pl-c1">or</span> <span class="pl-s1">shapes</span>) <span class="pl-c1">is</span> <span class="pl-s1">deprecated</span>. <span class="pl-v">If</span> <span class="pl-s1">you</span> <span class="pl-s1">meant</span> <span class="pl-s1">to</span> <span class="pl-s1">do</span> <span class="pl-s1">this</span>, <span class="pl-s1">you</span> <span class="pl-s1">must</span> <span class="pl-s1">specify</span> <span class="pl-s">'dtype=object'</span> <span class="pl-s1">when</span> <span class="pl-s1">creating</span> 
<span class="pl-v">ValueError</span>: <span class="pl-s1">could</span> <span class="pl-c1">not</span> <span class="pl-s1">broadcast</span> <span class="pl-s1">input</span> <span class="pl-s1">array</span> <span class="pl-k">from</span> <span class="pl-en">shape</span> (<span class="pl-c1">10</span>,<span class="pl-c1">3</span>) <span class="pl-s1">into</span> <span class="pl-en">shape</span> (<span class="pl-c1">10</span>)</pre></div>
<p dir="auto">since I still get an error even if I provide <code class="notranslate">dtype=object</code>:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.asarray([np.zeros((10, 3)), np.zeros(10)], dtype=object)
ValueError: could not broadcast input array from shape (10,3) into shape (10)"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-en">asarray</span>([<span class="pl-s1">np</span>.<span class="pl-en">zeros</span>((<span class="pl-c1">10</span>, <span class="pl-c1">3</span>)), <span class="pl-s1">np</span>.<span class="pl-en">zeros</span>(<span class="pl-c1">10</span>)], <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">object</span>)
<span class="pl-v">ValueError</span>: <span class="pl-s1">could</span> <span class="pl-c1">not</span> <span class="pl-s1">broadcast</span> <span class="pl-s1">input</span> <span class="pl-s1">array</span> <span class="pl-k">from</span> <span class="pl-en">shape</span> (<span class="pl-c1">10</span>,<span class="pl-c1">3</span>) <span class="pl-s1">into</span> <span class="pl-en">shape</span> (<span class="pl-c1">10</span>)</pre></div>
<p dir="auto"><del>In my mind, the behavior  most consistent with other ragged arrrays here would be to return an array of shape <code class="notranslate">(2, 10)</code> of dtype object, where some element are <code class="notranslate">np.float64</code> and others are objects arrays.</del></p>
<p dir="auto">At any rate, it would be nice to skip the deprecation here and/or emit a more helpful message.</p>