I don't understand that line.
``np.diff(X.indptr)`` gives the number of entries per column, doesn't it? (but I'm really tired so maybe not thinking straigt).