Skip to content

Commit

Permalink
fixed test as per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ante012 committed Aug 20, 2017
1 parent abc4591 commit 7001c99
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pandas/tests/indexing/test_iloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,15 @@ def test_iloc_setitem(self):
tm.assert_series_equal(s, expected)

@pytest.mark.parametrize(
"data, indexes, values, expected_k", [
([[1, 22, 5], [1, 33, 6]], [0, -1, 1], [2, 3, 1], [7, 10]),
'data, indexes, values, expected_k', [
# test without indexer value in first level of multiindex
([[2, 22, 5], [2, 33, 6]], [0, -1, 1], [2, 3, 1], [7, 10]),
([[1, 3, 7], [2, 4, 8]], [0, -1, 1], [1, 1, 10], [8, 19]),
# test like code sample 1 in the issue
([[1, 22, 555], [1, 33, 666]], [0, -1, 1], [200, 300, 100],
[755, 1066]),
# test like code sample 2 in the issue
([[1, 3, 7], [2, 4, 8]], [0, -1, 1], [10, 10, 1000], [17, 1018]),
# test like code sample 3 in the issue
([[1, 11, 4], [2, 22, 5], [3, 33, 6]], [0, -1, 1], [4, 7, 10],
[8, 15, 13])
])
Expand All @@ -283,14 +288,14 @@ def test_iloc_setitem_int_multiindex_series(
df = pd.DataFrame(
data=data,
columns=['i', 'j', 'k'])
df.set_index(['i', 'j'], inplace=True)
df = df.set_index(['i', 'j'])

series = df.k.copy()
for i, v in zip(indexes, values):
series.iloc[i] += v

df.k = expected_k
expected = df.k.copy()
df['k'] = expected_k
expected = df.k
tm.assert_series_equal(series, expected)

def test_iloc_setitem_list(self):
Expand Down

0 comments on commit 7001c99

Please sign in to comment.