@@ -1252,7 +1252,6 @@ def test_from_scipy_correct_ordering(spmatrix): |
|
|
1252 |
1252 |
tm.skip_if_no_package('scipy') |
1253 |
1253 |
|
1254 |
1254 |
arr = np.arange(1, 5).reshape(2, 2) |
1255 |
|
- |
1256 |
1255 |
try: |
1257 |
1256 |
spm = spmatrix(arr) |
1258 |
1257 |
assert spm.dtype == arr.dtype |
@@ -1268,9 +1267,9 @@ def test_from_scipy_correct_ordering(spmatrix): |
|
|
1268 |
1267 |
tm.assert_frame_equal(sdf.to_dense(), expected.to_dense()) |
1269 |
1268 |
|
1270 |
1269 |
|
1271 |
|
-def test_from_scipy_object_fillna(spmatrix): |
|
1270 |
+def test_from_scipy_fillna(spmatrix): |
1272 |
1271 |
# GH 16112 |
1273 |
|
-tm.skip_if_no_package('scipy', max_version='0.19.0') |
|
1272 |
+tm.skip_if_no_package('scipy') |
1274 |
1273 |
|
1275 |
1274 |
arr = np.eye(3) |
1276 |
1275 |
arr[1:, 0] = np.nan |
@@ -1287,12 +1286,11 @@ def test_from_scipy_object_fillna(spmatrix): |
|
|
1287 |
1286 |
sdf = pd.SparseDataFrame(spm).fillna(-1.0) |
1288 |
1287 |
|
1289 |
1288 |
# Returning frame should fill all nan values with -1.0 |
1290 |
|
-expected = pd.SparseDataFrame({0: {0: 1.0, 1: np.nan, 2: np.nan}, |
1291 |
|
-1: {0: np.nan, 1: 1.0, 2: np.nan}, |
1292 |
|
-2: {0: np.nan, 1: np.nan, 2: 1.0}} |
1293 |
|
- ).fillna(-1.0) |
|
1289 |
+expected = pd.SparseDataFrame([[1, -1, -1], |
|
1290 |
+ [-1, 1, -1], |
|
1291 |
+ [-1, -1, 1.]]) |
1294 |
1292 |
|
1295 |
|
-tm.assert_frame_equal(sdf.to_dense(), expected.to_dense()) |
|
1293 |
+tm.assert_numpy_array_equal(sdf.values, expected.values) |
1296 |
1294 |
|
1297 |
1295 |
|
1298 |
1296 |
class TestSparseDataFrameArithmetic(object): |