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

[PR] GH-49108: [Python] SparseCOOTensor.__repr__ missing f-string prefix [arrow]

chilin0525 opened a new pull request, #49109:
URL: https://github.com/apache/arrow/pull/49109

   ### Rationale for this change
   
   `SparseCOOTensor.__repr__` outputs literal `{self.type}` and `{self.shape}` instead of actual values due to missing f-string prefix.
   
   ### What changes are included in this PR?
   
   Add f prefix to the string in `SparseCOOTensor.__repr__`.
   
   ### Are these changes tested?
   
   Yes, work after adding. f-string prefix:
   ```python3
   >>> import pyarrow as pa
   >>> import numpy as np
   >>> dense_tensor = np.array([[0, 1, 0], [2, 0, 3]], dtype=np.float32)
   >>> sparse_coo = pa.SparseCOOTensor.from_dense_numpy(dense_tensor)
   >>> sparse_coo
   <pyarrow.SparseCOOTensor>
   type: float
   shape: (2, 3)
   ```
   
   ### Are there any user-facing changes?
   
   a bug that caused incorrect or invalid data to be produced:
   
   ```python3
   >>> import pyarrow as pa
   >>> import numpy as np
   >>> dense_tensor = np.array([[0, 1, 0], [2, 0, 3]], dtype=np.float32)
   >>> sparse_coo = pa.SparseCOOTensor.from_dense_numpy(dense_tensor)
   >>> sparse_coo
   <pyarrow.SparseCOOTensor>
   type: {self.type}
   shape: {self.shape}
   ```
   


-- 
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: [PR] GH-49108: [Python] SparseCOOTensor.__repr__ missing f-string prefix [arrow]

Posted by "raulcd (via GitHub)" <gi...@apache.org>.
raulcd merged PR #49109:
URL: https://github.com/apache/arrow/pull/49109


-- 
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: [PR] GH-49108: [Python] SparseCOOTensor.__repr__ missing f-string prefix [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49109:
URL: https://github.com/apache/arrow/pull/49109#issuecomment-3830616994

   :warning: GitHub issue #49108 **has been automatically assigned in GitHub** to PR creator.


-- 
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