Skip to content

Commit 198e333

Browse files
committed
fixup: further fix failing tests
1 parent d2fc814 commit 198e333

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

pandas/core/indexing.py

-5
Original file line numberDiff line numberDiff line change
@@ -1929,11 +1929,6 @@ def _has_valid_setitem_indexer(self, indexer):
19291929

19301930
def _convert_key(self, key, is_setter=False):
19311931
""" require integer args (and convert to label arguments) """
1932-
1933-
# allow arbitrary setting
1934-
if is_setter:
1935-
return list(key)
1936-
19371932
for a, i in zip(self.obj.axes, key):
19381933
if not is_integer(i):
19391934
raise ValueError("iAt based indexing can only have integer "

pandas/core/internals.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2816,8 +2816,7 @@ def _can_hold_element(self, element):
28162816
return np.can_cast(np.asarray(element).dtype, self.sp_values.dtype)
28172817

28182818
def _try_coerce_result(self, result):
2819-
if (
2820-
# isinstance(result, np.ndarray) and
2819+
if (isinstance(result, np.ndarray) and
28212820
np.ndim(result) > 0
28222821
and not is_sparse(result)):
28232822
result = SparseArray(result, kind=self.kind,
@@ -3821,8 +3820,7 @@ def fast_xs(self, loc):
38213820
# Such assignment may incorrectly coerce NaT to None
38223821
# result[blk.mgr_locs] = blk._slice((slice(None), loc))
38233822
for i, rl in enumerate(blk.mgr_locs):
3824-
# result[rl] = blk._try_coerce_result(blk.iget((i, loc)))
3825-
result[rl] = blk.iget((i, loc))
3823+
result[rl] = blk._try_coerce_result(blk.iget((i, loc)))
38263824

38273825
return result
38283826

pandas/tests/sparse/test_frame.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1560,19 +1560,22 @@ def spindex_kind(request):
15601560
return request.param
15611561

15621562

1563-
@pytest.mark.parametrize('indexer', ['at', 'iat'])
1564-
@pytest.mark.parametrize('key', [0])
1563+
@pytest.mark.parametrize('indexer', ['iat'])
1564+
@pytest.mark.parametrize('key', [(0, 0)])
15651565
def test_frame_assignment_at(spindex_kind, indexer, key):
15661566
_test_assignment(spindex_kind, indexer, key)
15671567

15681568

1569-
@pytest.mark.parametrize('indexer', ['loc', 'iloc'])
1570-
@pytest.mark.parametrize('key', [0, [0, 1], [True, False]])
1569+
@pytest.mark.parametrize('indexer', ['at', 'loc', 'iloc'])
1570+
@pytest.mark.parametrize('key', [0,
1571+
[0, 1],
1572+
[True, False]])
15711573
def test_frame_assignment_loc(spindex_kind, indexer, key):
15721574
_test_assignment(spindex_kind, indexer, key)
15731575

15741576

1575-
@pytest.mark.parametrize('key', [None, [True, False]])
1577+
@pytest.mark.parametrize('key', [None,
1578+
[True, False]])
15761579
def test_frame_assignment_setitem(spindex_kind, key):
15771580
_test_assignment(spindex_kind, None, key)
15781581

0 commit comments

Comments
 (0)