'Convert this matrix to Compressed Sparse Column format
Duplicate entries will be summed together.
Examples
>>> from numpy import array
>>> from scipy.sparse import coo_matrix
>>> row  = array([0, 0, 1, 3, 1, 0, 0])
>>> col  = array([0, 2, 1, 3, 1, 0, 0])
>>> data = array([1, 1, 1, 1, 1, 1, 1])
>>> A = coo_matrix((data, (row, col)), shape=(4, 4)).tocsc()
>>> A.toarray()
array([[3, 0, 1, 0],
[0, 2, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 1]])'

def tocsc(self, copy=False):

    from .csc import csc_matrix
    if (self.nnz == 0):
        return csc_matrix(self.shape, dtype=self.dtype)
    else:
        (M, N) = self.shape
        idx_dtype = get_index_dtype((self.col, self.row), maxval=max(self.nnz, M))
        row = self.row.astype(idx_dtype, copy=False)
        col = self.col.astype(idx_dtype, copy=False)
        indptr = np.empty((N + 1), dtype=idx_dtype)
        indices = np.empty_like(row, dtype=idx_dtype)
        data = np.empty_like(self.data, dtype=upcast(self.dtype))
        coo_tocsr(N, M, self.nnz, col, row, self.data, indptr, indices, data)
        x = csc_matrix((data, indices, indptr), shape=self.shape)
        if (not self.has_canonical_format):
            x.sum_duplicates()
        return x
