Skip to content

Commit 206790a

Browse files
committed
add regression test
1 parent 58dccd3 commit 206790a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pandas/tests/frame/indexing/test_sparse.py

+15
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,18 @@ def test_locindexer_from_spmatrix(self, spmatrix_t, dtype):
4949
result = df.loc[itr_idx].dtypes.values
5050
expected = np.full(cols, SparseDtype(dtype, fill_value=0))
5151
tm.assert_numpy_array_equal(result, expected)
52+
53+
def test_reindex(self):
54+
# https://github.com/pandas-dev/pandas/issues/35286
55+
df = pd.DataFrame(
56+
{"A": [0, 1], "B": pd.array([0, 1], dtype=pd.SparseDtype("int64", 0))}
57+
)
58+
result = df.reindex([0, 2])
59+
expected = pd.DataFrame(
60+
{
61+
"A": [0.0, np.nan],
62+
"B": pd.array([0.0, np.nan], dtype=pd.SparseDtype("float64", 0.0)),
63+
},
64+
index=[0, 2],
65+
)
66+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)