title: Convert U1 array to int in Python
body: <p>I have the following array "class_id"</p>
  
  <pre><code>array([[array(['2'], 
    dtype='&lt;U1')],
     [array(['3'], 
    dtype='&lt;U1')],
     [array(['2'], 
    dtype='&lt;U1')],
     ..., 
     [array(['2'], 
    dtype='&lt;U1')],
     [array(['2'], 
    dtype='&lt;U1')],
     [array(['2'], 
    dtype='&lt;U1')]], dtype=object)
  </code></pre>
  
  <p>When I'm using the function:</p>
  
  <p>class_id.astype(int) </p>
  
  <p>I get the following error:</p>
  
  <pre><code>   ValueError: setting an array element with a sequence.
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-124-3ad39bf87e7d&gt; in &lt;module&gt;()
  ----&gt; 1 class_id.astype(int)
  ValueError: setting an array element with a sequence.
  </code></pre>
  
  <p>I would like to get the following array:</p>
  
  <pre><code>array([[1],
     [2],
     [1],
     ..., 
     [1],
     [1],
     [1]])
  </code></pre>
  
  <p>Which function should I use? </p>