Skip to content

Commit 4efdd35

Browse files
committed
Adding type check to from_pydata_sparse.
1 parent 759e0b3 commit 4efdd35

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/pyarrow/tensor.pxi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ shape: {0.shape}""".format(self)
212212
"""
213213
Convert pydata/sparse.COO to arrow::SparseCOOTensor
214214
"""
215+
import sparse
216+
if not isinstance(obj, sparse.COO):
217+
raise TypeError(
218+
"Expected sparse.COO, got {}".format(type(obj)))
219+
215220
cdef shared_ptr[CSparseCOOTensor] csparse_tensor
216221
cdef vector[int64_t] c_shape
217222
cdef vector[c_string] c_dim_names

0 commit comments

Comments
 (0)