You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "chilin0525 (via GitHub)" <gi...@apache.org> on 2026/02/13 15:54:10 UTC

[I] [Python][Doc] Add examples for non-dense sparse tensor constructors [arrow]

chilin0525 opened a new issue, #49278:
URL: https://github.com/apache/arrow/issues/49278

   ### Describe the enhancement requested
   
   Follow-up from #49147 (comment: https://github.com/apache/arrow/pull/49147#issuecomment-3879302706).
   
   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)`
   - `from_scipy(obj, dim_names=None)`
   - `from_pydata_sparse(obj, dim_names=None)`
   - `from_tensor(obj)`
   
   **`SparseCSRMatrix`**
   - `from_numpy(data, indptr, indices, shape, dim_names=None)`
   - `from_scipy(obj, dim_names=None)`
   - `from_tensor(obj)`
   
   **`SparseCSCMatrix`**
   - `from_numpy(data, indptr, indices, shape, dim_names=None)`
   - `from_scipy(obj, dim_names=None)`
   - `from_tensor(obj)`
   
   **`SparseCSFTensor`**
   - `from_numpy(data, indptr, indices, shape, axis_order=None, dim_names=None)`
   - `from_tensor(obj)`
   
   
   ### Component(s)
   
   Python


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python][Doc] Add examples for non-dense sparse tensor constructors [arrow]

Posted by "rok (via GitHub)" <gi...@apache.org>.
rok commented on issue #49278:
URL: https://github.com/apache/arrow/issues/49278#issuecomment-3897969618

   Thanks for working on this @chilin0525 !
   I would suggest to only add `from_numpy` examples as they demonstrate the optimal use of the underlying data structures.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python][Doc] Add examples for non-dense sparse tensor constructors [arrow]

Posted by "chilin0525 (via GitHub)" <gi...@apache.org>.
chilin0525 commented on issue #49278:
URL: https://github.com/apache/arrow/issues/49278#issuecomment-3897986163

   @rok Thanks for the suggestion! I’ll update the issue title and adjust the content accordingly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python][Doc] Add from_numpy examples for sparse tensor constructors [arrow]

Posted by "AlenkaF (via GitHub)" <gi...@apache.org>.
AlenkaF commented on issue #49278:
URL: https://github.com/apache/arrow/issues/49278#issuecomment-4046588025

   Issue resolved by pull request 49279
   https://github.com/apache/arrow/pull/49279


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python][Doc] Add from_numpy examples for sparse tensor constructors [arrow]

Posted by "chilin0525 (via GitHub)" <gi...@apache.org>.
chilin0525 commented on issue #49278:
URL: https://github.com/apache/arrow/issues/49278#issuecomment-3897993639

   take


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Python][Doc] Add from_numpy examples for sparse tensor constructors [arrow]

Posted by "AlenkaF (via GitHub)" <gi...@apache.org>.
AlenkaF closed issue #49278: [Python][Doc] Add from_numpy examples for sparse tensor constructors
URL: https://github.com/apache/arrow/issues/49278


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org