We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9f26e2 commit 8391b44Copy full SHA for 8391b44
pandas/tests/series/indexing/test_loc.py
@@ -157,3 +157,17 @@ def test_basic_setitem_with_labels(datetime_series):
157
s2["a"] = expected
158
result = s2["a"]
159
assert result == expected
160
+
161
+# test for issue https://github.com/pandas-dev/pandas/issues/29563
162
+def indexing_work_after_changing_Serie_SparseDType():
163
164
+ fill_value = 0
165
166
+ s = pd.Series([fill_value])
167
+ tm.assert_series_equal(s, s.loc[[fill_value]])
168
+ dtype = pd.SparseDtype("float", fill_value=fill_value)
169
+ s = s.astype(dtype)
170
171
+ # s[[fill_value]] calls s.loc so this almoast the same test
172
173
+ tm.assert_series_equal(s, s[[fill_value]])
0 commit comments