@@ -819,55 +819,57 @@ def test_duplicated_with_nas(self):
819
819
expected = np .array (trues + trues )
820
820
tm .assert_numpy_array_equal (result , expected )
821
821
822
- def test_numeric_object_likes (self ):
823
- cases = [np .array ([1 , 2 , 1 , 5 , 3 ,
824
- 2 , 4 , 1 , 5 , 6 ]),
825
- np .array ([1.1 , 2.2 , 1.1 , np .nan , 3.3 ,
826
- 2.2 , 4.4 , 1.1 , np .nan , 6.6 ]),
827
- np .array ([1 + 1j , 2 + 2j , 1 + 1j , 5 + 5j , 3 + 3j ,
828
- 2 + 2j , 4 + 4j , 1 + 1j , 5 + 5j , 6 + 6j ]),
829
- np .array (['a' , 'b' , 'a' , 'e' , 'c' ,
830
- 'b' , 'd' , 'a' , 'e' , 'f' ], dtype = object ),
831
- np .array ([1 , 2 ** 63 , 1 , 3 ** 5 , 10 ,
832
- 2 ** 63 , 39 , 1 , 3 ** 5 , 7 ], dtype = np .uint64 )]
833
-
822
+ @pytest .mark .parametrize ('case' , [
823
+ np .array ([1 , 2 , 1 , 5 , 3 ,
824
+ 2 , 4 , 1 , 5 , 6 ]),
825
+ np .array ([1.1 , 2.2 , 1.1 , np .nan , 3.3 ,
826
+ 2.2 , 4.4 , 1.1 , np .nan , 6.6 ]),
827
+ pytest .mark .xfail (resaon = "Complex bug. GH 16399" )(
828
+ np .array ([1 + 1j , 2 + 2j , 1 + 1j , 5 + 5j , 3 + 3j ,
829
+ 2 + 2j , 4 + 4j , 1 + 1j , 5 + 5j , 6 + 6j ])
830
+ ),
831
+ np .array (['a' , 'b' , 'a' , 'e' , 'c' ,
832
+ 'b' , 'd' , 'a' , 'e' , 'f' ], dtype = object ),
833
+ np .array ([1 , 2 ** 63 , 1 , 3 ** 5 , 10 , 2 ** 63 , 39 , 1 , 3 ** 5 , 7 ],
834
+ dtype = np .uint64 ),
835
+ ])
836
+ def test_numeric_object_likes (self , case ):
834
837
exp_first = np .array ([False , False , True , False , False ,
835
838
True , False , True , True , False ])
836
839
exp_last = np .array ([True , True , True , True , False ,
837
840
False , False , False , False , False ])
838
841
exp_false = exp_first | exp_last
839
842
840
- for case in cases :
841
- res_first = algos .duplicated (case , keep = 'first' )
842
- tm .assert_numpy_array_equal (res_first , exp_first )
843
+ res_first = algos .duplicated (case , keep = 'first' )
844
+ tm .assert_numpy_array_equal (res_first , exp_first )
843
845
844
- res_last = algos .duplicated (case , keep = 'last' )
845
- tm .assert_numpy_array_equal (res_last , exp_last )
846
+ res_last = algos .duplicated (case , keep = 'last' )
847
+ tm .assert_numpy_array_equal (res_last , exp_last )
846
848
847
- res_false = algos .duplicated (case , keep = False )
848
- tm .assert_numpy_array_equal (res_false , exp_false )
849
+ res_false = algos .duplicated (case , keep = False )
850
+ tm .assert_numpy_array_equal (res_false , exp_false )
849
851
850
- # index
851
- for idx in [pd .Index (case ), pd .Index (case , dtype = 'category' )]:
852
- res_first = idx .duplicated (keep = 'first' )
853
- tm .assert_numpy_array_equal (res_first , exp_first )
852
+ # index
853
+ for idx in [pd .Index (case ), pd .Index (case , dtype = 'category' )]:
854
+ res_first = idx .duplicated (keep = 'first' )
855
+ tm .assert_numpy_array_equal (res_first , exp_first )
854
856
855
- res_last = idx .duplicated (keep = 'last' )
856
- tm .assert_numpy_array_equal (res_last , exp_last )
857
+ res_last = idx .duplicated (keep = 'last' )
858
+ tm .assert_numpy_array_equal (res_last , exp_last )
857
859
858
- res_false = idx .duplicated (keep = False )
859
- tm .assert_numpy_array_equal (res_false , exp_false )
860
+ res_false = idx .duplicated (keep = False )
861
+ tm .assert_numpy_array_equal (res_false , exp_false )
860
862
861
- # series
862
- for s in [Series (case ), Series (case , dtype = 'category' )]:
863
- res_first = s .duplicated (keep = 'first' )
864
- tm .assert_series_equal (res_first , Series (exp_first ))
863
+ # series
864
+ for s in [Series (case ), Series (case , dtype = 'category' )]:
865
+ res_first = s .duplicated (keep = 'first' )
866
+ tm .assert_series_equal (res_first , Series (exp_first ))
865
867
866
- res_last = s .duplicated (keep = 'last' )
867
- tm .assert_series_equal (res_last , Series (exp_last ))
868
+ res_last = s .duplicated (keep = 'last' )
869
+ tm .assert_series_equal (res_last , Series (exp_last ))
868
870
869
- res_false = s .duplicated (keep = False )
870
- tm .assert_series_equal (res_false , Series (exp_false ))
871
+ res_false = s .duplicated (keep = False )
872
+ tm .assert_series_equal (res_false , Series (exp_false ))
871
873
872
874
def test_datetime_likes (self ):
873
875
0 commit comments