Skip to content

Commit 96d5144

Browse files
committed
py2 compat
1 parent 8c4ab5b commit 96d5144

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/tests/test_categorical.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -563,22 +563,22 @@ def f():
563563
@pytest.mark.parametrize('dtype', [None, 'category'])
564564
def test_from_inferred_categories(self, dtype):
565565
cats = ['a', 'b']
566-
codes = [0, 0, 1, 1]
566+
codes = np.array([0, 0, 1, 1], dtype='i8')
567567
result = Categorical._from_inferred_categories(cats, codes, dtype)
568568
expected = Categorical.from_codes(codes, cats)
569569
tm.assert_categorical_equal(result, expected)
570570

571571
@pytest.mark.parametrize('dtype', [None, 'category'])
572572
def test_from_inferred_categories_sorts(self, dtype):
573573
cats = ['b', 'a']
574-
codes = [0, 1, 1, 1]
574+
codes = np.array([0, 1, 1, 1], dtype='i8')
575575
result = Categorical._from_inferred_categories(cats, codes, dtype)
576576
expected = Categorical.from_codes([1, 0, 0, 0], ['a', 'b'])
577577
tm.assert_categorical_equal(result, expected)
578578

579579
def test_from_inferred_categories_dtype(self):
580580
cats = ['a', 'b', 'd']
581-
codes = [0, 1, 0, 2]
581+
codes = np.array([0, 1, 0, 2], dtype='i8')
582582
dtype = CategoricalDtype(['c', 'b', 'a'], ordered=True)
583583
result = Categorical._from_inferred_categories(cats, codes, dtype)
584584
expected = Categorical(['a', 'b', 'a', 'd'],
@@ -588,7 +588,7 @@ def test_from_inferred_categories_dtype(self):
588588

589589
def test_from_inferred_categories_coerces(self):
590590
cats = ['1', '2', 'bad']
591-
codes = [0, 0, 1, 2]
591+
codes = np.array([0, 0, 1, 2], dtype='i8')
592592
dtype = CategoricalDtype([1, 2])
593593
result = Categorical._from_inferred_categories(cats, codes, dtype)
594594
expected = Categorical([1, 1, 2, np.nan])

0 commit comments

Comments
 (0)