@@ -563,22 +563,22 @@ def f():
563
563
@pytest .mark .parametrize ('dtype' , [None , 'category' ])
564
564
def test_from_inferred_categories (self , dtype ):
565
565
cats = ['a' , 'b' ]
566
- codes = [0 , 0 , 1 , 1 ]
566
+ codes = np . array ( [0 , 0 , 1 , 1 ], dtype = 'i8' )
567
567
result = Categorical ._from_inferred_categories (cats , codes , dtype )
568
568
expected = Categorical .from_codes (codes , cats )
569
569
tm .assert_categorical_equal (result , expected )
570
570
571
571
@pytest .mark .parametrize ('dtype' , [None , 'category' ])
572
572
def test_from_inferred_categories_sorts (self , dtype ):
573
573
cats = ['b' , 'a' ]
574
- codes = [0 , 1 , 1 , 1 ]
574
+ codes = np . array ( [0 , 1 , 1 , 1 ], dtype = 'i8' )
575
575
result = Categorical ._from_inferred_categories (cats , codes , dtype )
576
576
expected = Categorical .from_codes ([1 , 0 , 0 , 0 ], ['a' , 'b' ])
577
577
tm .assert_categorical_equal (result , expected )
578
578
579
579
def test_from_inferred_categories_dtype (self ):
580
580
cats = ['a' , 'b' , 'd' ]
581
- codes = [0 , 1 , 0 , 2 ]
581
+ codes = np . array ( [0 , 1 , 0 , 2 ], dtype = 'i8' )
582
582
dtype = CategoricalDtype (['c' , 'b' , 'a' ], ordered = True )
583
583
result = Categorical ._from_inferred_categories (cats , codes , dtype )
584
584
expected = Categorical (['a' , 'b' , 'a' , 'd' ],
@@ -588,7 +588,7 @@ def test_from_inferred_categories_dtype(self):
588
588
589
589
def test_from_inferred_categories_coerces (self ):
590
590
cats = ['1' , '2' , 'bad' ]
591
- codes = [0 , 0 , 1 , 2 ]
591
+ codes = np . array ( [0 , 0 , 1 , 2 ], dtype = 'i8' )
592
592
dtype = CategoricalDtype ([1 , 2 ])
593
593
result = Categorical ._from_inferred_categories (cats , codes , dtype )
594
594
expected = Categorical ([1 , 1 , 2 , np .nan ])
0 commit comments