Skip to content

Commit e2de850

Browse files
committed
fixup! ENH: Native conversion from/to scipy.sparse matrix to SparseDataFrame
1 parent 12c9248 commit e2de850

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pandas/tests/sparse/test_frame.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,8 @@ def test_isnotnull(self):
11201120

11211121
def test_from_to_scipy(self):
11221122
# GH 4343
1123-
try:
1124-
from scipy.sparse import csr_matrix
1125-
except ImportError:
1126-
return # scipy not available
1123+
tm._skip_if_no_scipy()
1124+
from scipy.sparse import csr_matrix
11271125

11281126
arr = np.array([[0, 1, 0],
11291127
[0, 0, 1],

pandas/util/testing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ def _skip_if_no_scipy():
297297
except ImportError:
298298
import pytest
299299
pytest.skip('scipy.interpolate missing')
300+
try:
301+
import scipy.sparse
302+
except ImportError:
303+
import pytest
304+
pytest.skip('scipy.sparse missing')
300305

301306

302307
def _skip_if_scipy_0_17():

0 commit comments

Comments
 (0)