How do I view data object contents within an npz file?

本秂侑毒 提交于 2019-12-05 02:54:34

问题


I am using Spyder IDE and Python 2.7.

I have a npz file called data.npz which was given to me. I want to load this file into Spyder and view whatever is inside.

To start I've done this:

import numpy as np
data = np.load('data.npz')

In my Variable Explorer in Spyder, I have a variable with the name "data" and the type "object". When I double-click on this variable, Spyder gives an error saying "object arrays are currently not supported".

When I just type

data

I get something like this:

array({'a': array([ 1,2,3, ...,
         4,5,6]), 'b': 10, 'c': array([-1,-2,-3]), 'd': 25, 'e': 1}, dtype=object)

How do I access 'a', 'b', 'c', 'd', etc?

来源:https://stackoverflow.com/questions/44289302/how-do-i-view-data-object-contents-within-an-npz-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!