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 Correct

Click 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).())

    
  




Go to w3schools.com
Reset Score
Close This Menu

Completed 0 of 20 Exercises:

SCIPY Constants
SCIPY Optimizers
SCIPY Sparse Data
SCIPY Graphs
SCIPY Spatial Data
SCIPY Interpolation
SCIPY Matlab Arrays
SCIPY Significance Tests

×

Reset the Score?

This will reset the score of ALL 20 exercises.

Are you sure you want to continue?



×

Congratulations!

You have finished all 20 SCIPY exercises.

Share your score: