Skip to content

Commit 65b2392

Browse files
committed
fixup: further fix failing tests
1 parent c817554 commit 65b2392

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
@@ -1933,11 +1933,6 @@ def _has_valid_setitem_indexer(self, indexer):
19331933

19341934
def _convert_key(self, key, is_setter=False):
19351935
""" require integer args (and convert to label arguments) """
1936-
1937-
# allow arbitrary setting
1938-
if is_setter:
1939-
return list(key)
1940-
19411936
for a, i in zip(self.obj.axes, key):
19421937
if not is_integer(i):
19431938
raise ValueError("iAt based indexing can only have integer "

pandas/core/internals.py

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

27672767
def _try_coerce_result(self, result):
2768-
if (
2769-
# isinstance(result, np.ndarray) and
2768+
if (isinstance(result, np.ndarray) and
27702769
np.ndim(result) > 0
27712770
and not is_sparse(result)):
27722771
result = SparseArray(result, kind=self.kind,
@@ -3770,8 +3769,7 @@ def fast_xs(self, loc):
37703769
# Such assignment may incorrectly coerce NaT to None
37713770
# result[blk.mgr_locs] = blk._slice((slice(None), loc))
37723771
for i, rl in enumerate(blk.mgr_locs):
3773-
# result[rl] = blk._try_coerce_result(blk.iget((i, loc)))
3774-
result[rl] = blk.iget((i, loc))
3772+
result[rl] = blk._try_coerce_result(blk.iget((i, loc)))
37753773

37763774
return result
37773775

pandas/tests/sparse/test_frame.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -1424,19 +1424,22 @@ def spindex_kind(request):
14241424
return request.param
14251425

14261426

1427-
@pytest.mark.parametrize('indexer', ['at', 'iat'])
1428-
@pytest.mark.parametrize('key', [0])
1427+
@pytest.mark.parametrize('indexer', ['iat'])
1428+
@pytest.mark.parametrize('key', [(0, 0)])
14291429
def test_frame_assignment_at(spindex_kind, indexer, key):
14301430
_test_assignment(spindex_kind, indexer, key)
14311431

14321432

1433-
@pytest.mark.parametrize('indexer', ['loc', 'iloc'])
1434-
@pytest.mark.parametrize('key', [0, [0, 1], [True, False]])
1433+
@pytest.mark.parametrize('indexer', ['at', 'loc', 'iloc'])
1434+
@pytest.mark.parametrize('key', [0,
1435+
[0, 1],
1436+
[True, False]])
14351437
def test_frame_assignment_loc(spindex_kind, indexer, key):
14361438
_test_assignment(spindex_kind, indexer, key)
14371439

14381440

1439-
@pytest.mark.parametrize('key', [None, [True, False]])
1441+
@pytest.mark.parametrize('key', [None,
1442+
[True, False]])
14401443
def test_frame_assignment_setitem(spindex_kind, key):
14411444
_test_assignment(spindex_kind, None, key)
14421445

0 commit comments

Comments
 (0)