Trouble using numpy.load
<p>I have the following data, written in python 2, that I'd like to load to a python 3 file.</p>

<pre><code>import numpy as np
x = np.array([{'a': np.array([1., 2., 3])}])
np.save('data.npy', x)
</code></pre>

<p>My first attempt was this:</p>

<pre><code>import numpy as np
x = np.load('data.npy')

UnicodeError: Unpickling a python object failed
</code></pre>

<p>After playing around with the original data I am trying to load, it seems that whenever I have a numpy float inside of a numpy array inside a python dictionary, I get the error. I can load a dictionary, I can load a numpy array, I can even load a numpy array inside a python dictionary, but as soon as I have numpy floats inside a numpy array inside a python dictionary, I get the error. My second attempt was this:</p>

<pre><code>import numpy as np
x = np.load('data.npy', encoding = 'bytes')
x

array([{b'a': array([ 1.,  2.,  3.])}], dtype=object)
</code></pre>

<p>This worked in that I could load the data, but it added a 'b' in front of every key in the dictionary. I was wondering if anyone had any insight into why this problem is occuring and how to fix it.</p>

<p>Thanks!</p>

<p>edit:</p>

<p>it seems like the following solved the problem:</p>

<pre><code>import numpy as np
x = np.load('data.npy', encoding = 'latin1')
</code></pre>