We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e11ba01 commit b970cebCopy full SHA for b970ceb
pandas/tests/arrays/sparse/test_array.py
@@ -1295,3 +1295,15 @@ def test_map_missing():
1295
1296
result = arr.map({0: 10, 1: 11})
1297
tm.assert_sp_array_equal(result, expected)
1298
+
1299
1300
+@pytest.mark.parametrize("fill_value", [np.nan, 1])
1301
+def test_dropna(fill_value):
1302
+ # GH-28287
1303
+ arr = SparseArray([np.nan, 1], fill_value=fill_value)
1304
+ exp = SparseArray([1.0], fill_value=fill_value)
1305
+ tm.assert_sp_array_equal(arr.dropna(), exp)
1306
1307
+ df = pd.DataFrame({"a": [0, 1], "b": arr})
1308
+ expected_df = pd.DataFrame({"a": [1], "b": exp}, index=pd.Int64Index([1]))
1309
+ tm.assert_equal(df.dropna(), expected_df)
0 commit comments