Skip to content

[Python][Doc] Add from_numpy examples for sparse tensor constructors #49278

@chilin0525

Description

@chilin0525

Describe the enhancement requested

Follow-up from #49147 (comment: #49147 (comment)).

PR #49147 added class-level docstring examples for SparseCOOTensor, SparseCSRMatrix, SparseCSCMatrix, and SparseCSFTensor. Currently, all examples only demonstrate construction via from_dense_numpy(). As @rok suggested, it would be useful to also add examples for the non-dense constructors that build sparse tensors directly from sparse data structures.

The following factory methods in python/pyarrow/tensor.pxi are missing docstring examples:

SparseCOOTensor

  • from_numpy(data, coords, shape, dim_names=None)

SparseCSRMatrix

  • from_numpy(data, indptr, indices, shape, dim_names=None)

SparseCSCMatrix

  • from_numpy(data, indptr, indices, shape, dim_names=None)

SparseCSFTensor

  • from_numpy(data, indptr, indices, shape, axis_order=None, dim_names=None)

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions