Maybe this explanation can help understand the concept:
datais an array containing all the non zero elements of the sparse matrix.indicesis an array mapping each element indatato its column in the sparse matrix.-
indptrthen maps the elements ofdataandindicesto the rows of the sparse matrix. This is done with the following reasoning:- If the sparse matrix has M rows,
indptris an array containing M+1 elements - for row i,
[indptr[i]:indptr[i+1]]returns the indices of elements to take fromdataandindicescorresponding to row i. So supposeindptr[i]=kandindptr[i+1]=l, the data corresponding to row i would bedata[k:l]at columnsindices[k:l]. This is the tricky part, and I hope the following example helps understanding it.
- If the sparse matrix has M rows,
EDIT : I replaced the numbers in data by letters to avoid confusion in the following example.

Note: the values in indptr are necessarily increasing, because the next cell in indptr (the next row) is referring to the next values in data and indices corresponding to that row.