Skip to content

Commit 5bf1d9c

Browse files
committed
Merge pull request #3839 from hayd/GH_3836
TST regression tests for GH3836
2 parents 58642a6 + 6b5c2a0 commit 5bf1d9c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/tests/test_indexing.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,23 @@ def test_iloc_mask(self):
974974
(key,ans,r))
975975
warnings.filterwarnings(action='always', category=UserWarning)
976976

977+
def test_ix_slicing_strings(self):
978+
##GH3836
979+
data = {'Classification': ['SA EQUITY CFD', 'bbb', 'SA EQUITY', 'SA SSF', 'aaa'],
980+
'Random': [1,2,3,4,5],
981+
'X': ['correct', 'wrong','correct', 'correct','wrong']}
982+
df = DataFrame(data)
983+
x = df[~df.Classification.isin(['SA EQUITY CFD', 'SA EQUITY', 'SA SSF'])]
984+
df.ix[x.index,'X'] = df['Classification']
985+
986+
expected = DataFrame({'Classification': {0: 'SA EQUITY CFD', 1: 'bbb',
987+
2: 'SA EQUITY', 3: 'SA SSF', 4: 'aaa'},
988+
'Random': {0: 1, 1: 2, 2: 3, 3: 4, 4: 5},
989+
'X': {0: 'correct', 1: 'bbb', 2: 'correct',
990+
3: 'correct', 4: 'aaa'}}) # bug was 4: 'bbb'
991+
992+
assert_frame_equal(df, expected)
993+
977994
def test_non_unique_loc(self):
978995
## GH3659
979996
## non-unique indexer with loc slice

0 commit comments

Comments
 (0)