| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.SparseCSCMatrix.html | [Back] [Original] |
Section Navigation
Bases: _Weakrefable
A sparse CSC (Compressed Sparse Column) matrix.
CSC format stores a sparse matrix by compressing the column information. It uses three arrays: data (non-zero values), indices (row indices), and indptr (column pointers that indicate where each column starts in the data array). CSC is the transpose of CSR format.
Examples
>>> import pyarrow as pa
>>> import numpy as np
>>> dense_matrix = np.array([[1, 0, 2], [0, 0, 3]], dtype=np.float64)
>>> sparse_csc = pa.SparseCSCMatrix.from_dense_numpy(dense_matrix)
>>> sparse_csc
<pyarrow.SparseCSCMatrix>
type: double
shape: (2, 3)
Methods
|
|
|
Returns the name of the i-th tensor dimension. |
|
Return true if sparse tensors contains exactly equal data |
|
Convert numpy.ndarray to arrow::SparseCSCMatrix |
|
Create arrow::SparseCSCMatrix from numpy.ndarrays |
|
Convert scipy.sparse.csc_array or scipy.sparse.csc_matrix to arrow::SparseCSCMatrix |
|
Convert arrow::Tensor to arrow::SparseCSCMatrix |
|
Convert arrow::SparseCSCMatrix to numpy.ndarrays with zero copy |
|
Convert arrow::SparseCSCMatrix to scipy.sparse.csc_array |
|
Convert arrow::SparseCSCMatrix to arrow::Tensor |
Attributes
Returns the name of the i-th tensor dimension.
Return true if sparse tensors contains exactly equal data
SparseCSCMatrixThe other tensor to compare for equality.
Convert numpy.ndarray to arrow::SparseCSCMatrix
numpy.ndarrayData used to populate the rows.
list[str], optionalNames of the dimensions.
Create arrow::SparseCSCMatrix from numpy.ndarrays
numpy.ndarrayData used to populate the sparse matrix.
numpy.ndarrayRange of the rows, The i-th row spans from indptr[i] to indptr[i+1] in the data.
numpy.ndarrayColumn indices of the corresponding non-zero values.
tupleShape of the matrix.
list, optionalNames of the dimensions.
Examples
>>> import pyarrow as pa
>>> import numpy as np
>>> data = np.array([1.0, 3.0, 2.0], dtype=np.float64)
>>> indptr = np.array([0, 1, 2, 3], dtype=np.int64)
>>> indices = np.array([0, 1, 0], dtype=np.int64)
>>> sparse_csc = pa.SparseCSCMatrix.from_numpy(
... data, indptr, indices, shape=(2, 3))
>>> sparse_csc
<pyarrow.SparseCSCMatrix>
type: double
shape: (2, 3)
Convert scipy.sparse.csc_array or scipy.sparse.csc_matrix to arrow::SparseCSCMatrix
scipy.sparse.csc_array or scipy.sparse.csc_matrixThe scipy matrix that should be converted.
list, optionalNames of the dimensions.
Convert arrow::Tensor to arrow::SparseCSCMatrix
TensorThe dense tensor that should be converted.
Convert arrow::SparseCSCMatrix to numpy.ndarrays with zero copy
Convert arrow::SparseCSCMatrix to scipy.sparse.csc_array
Convert arrow::SparseCSCMatrix to arrow::Tensor
SparseCSCMatrixSparseCSCMatrix.__init__()SparseCSCMatrix.dim_name()SparseCSCMatrix.dim_namesSparseCSCMatrix.equals()SparseCSCMatrix.from_dense_numpy()SparseCSCMatrix.from_numpy()SparseCSCMatrix.from_scipy()SparseCSCMatrix.from_tensor()SparseCSCMatrix.is_mutableSparseCSCMatrix.ndimSparseCSCMatrix.non_zero_lengthSparseCSCMatrix.shapeSparseCSCMatrix.sizeSparseCSCMatrix.to_numpy()SparseCSCMatrix.to_scipy()SparseCSCMatrix.to_tensor()SparseCSCMatrix.type
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |