"TypeError: 'NpzFile' object is not callable " in Colab

Viewed 163

I'm trying to load the npz file using np.load() function in Colab (.ipynb), but the "TypeError: 'NpzFile' object is not callable " appears in the 4th line below.

import numpy as np
a1 = np.array([1,2,3])
np.savez_compressed('some_data.npz', A=a1)
data1 = np.load('some_data.npz', 'r', encoding='latin1')
data1A = data1['A']

Could you find what is the problem?

1 Answers

Your code works exactly as is on colab when I checked. The version of numpy I'm running there is 1.19.5. Here is the screenshot:

enter image description here

Related