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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to