Convert a numpy array of lists to a numpy array
<p>I have some data which is stored as a numpy array with <code>dtype=object</code>, and I would like to extract one column of lists and convert it to a numpy array.  It seems like a simple problem, but the only way I've found to solve it is to recast the entire thing as a list of lists and then recast it as a numpy array.  Is there a more pythonic approach?</p>

<pre><code>import numpy as np

arr = np.array([[1, ['a', 'b', 'c']], [2, ['a', 'b', 'c']]], dtype=object)
arr = arr[:, 1]

print(arr)
# [['a', 'b', 'c'] ['a', 'b', 'c']]

type(arr)
# numpy.ndarray
type(arr[0])
# list

arr.shape
# (2,)
</code></pre>

<p>Recasting the array as <code>dtype=str</code> raises a <code>ValueError</code> since it is trying to convert each list to a string.</p>

<pre><code>arr.astype(str)
# ValueError: setting an array element with a sequence
</code></pre>

<p>It is possible to rebuild the entire array as a list of lists and then cast it as a numpy array, but this seems like a roundabout way.</p>

<pre><code>arr_2 = np.array(list(arr))

type(arr_2)
# numpy.ndarray
type(arr_2[0])
# numpy.ndarray

arr_2.shape
# (2, 3)
</code></pre>

<p>Is there a better way to do this?</p>