Skip to content

Commit a91f6ea

Browse files
committed
fixup! ENH: SparseDataFrame supports scipy.sparse.spmatrix in setitem
1 parent 97da8bd commit a91f6ea

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/sparse/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def __setitem__(self, key, value):
440440
else:
441441
# 2d; make it iterable
442442
value = list(value.tocsc().T)
443-
super().__setitem__(key, value)
443+
super(SparseDataFrame, self).__setitem__(key, value)
444444

445445
@Appender(DataFrame.get_value.__doc__, indents=0)
446446
def get_value(self, index, col, takeable=False):

pandas/tests/sparse/test_frame.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ def test_setitem_spmatrix(self):
558558

559559
# 1d row -- changing series contents not yet supported
560560
spm = csr_matrix(np.arange(sdf.shape[1])).astype(float)
561-
idx = np.r_[[False, True], np.full(sdf.shape[0] - 2, False)]
561+
idx = np.zeros(sdf.shape[0], dtype=bool)
562+
idx[1] = True
562563
tm.assert_raises_regex(TypeError, 'assignment',
563564
lambda: sdf.__setitem__(idx, spm))
564565

0 commit comments

Comments
 (0)