Menu
×
×
Correct!
Exercise:Insert the missing method to print the number of values in the array that are NOT zeros:
import numpy as np
from scipy.sparse import csr_matrix
arr = np.array([[0, 0, 0], [0, 0, 1], [1, 0, 2]])
print(csr_matrix(arr).count_nonzero())
Not CorrectClick here to try again. Correct!Next ❯import numpy as np from scipy.sparse import csr_matrix arr = np.array([[0, 0, 0], [0, 0, 1], [1, 0, 2]]) print(csr_matrix(arr).()) |