Commit 012fd17
authored
### 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}
```
* GitHub Issue: #49108
Authored-by: Chilin <chilin.cs07@nycu.edu.tw>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 644ec57 commit 012fd17
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
0 commit comments