@@ -2138,16 +2138,26 @@ def test_series_value_counts_numeric_dropna_false(self):
21382138 def test_impl (S ):
21392139 return S .value_counts (dropna = False )
21402140
2141- data_to_test = [[1 , 2 , 3 , 1 , 1 , 3 ],
2142- [1 , 2 , 3 , np .nan , 1 , 3 , np .nan , np .inf ],
2143- [0.1 , 3. , np .nan , 3. , 0.1 , 3. , np .nan , np .inf , 0.1 , 0.1 ]]
2141+ data_to_test = [
2142+ [1 , 2 , 3 , 1 , 1 , 3 ],
2143+ [1 , 2 , 3 , np .nan , 1 , 3 , np .nan , np .inf ],
2144+ [0.1 , 3. , np .nan , 3. , 0.1 , 3. , np .nan , np .inf , 0.1 , 0.1 ]
2145+ ]
21442146
21452147 hpat_func = self .jit (test_impl )
21462148
21472149 for data in data_to_test :
21482150 with self .subTest (series_data = data ):
21492151 S = pd .Series (data )
2150- pd .testing .assert_series_equal (hpat_func (S ), test_impl (S ))
2152+ result = hpat_func (S )
2153+ result_ref = test_impl (S )
2154+
2155+ # order within groups of same counts may be different since
2156+ # pandas impl uses sort_values() with default kind='quicksort'
2157+ pd .testing .assert_series_equal (
2158+ result .sort_index (),
2159+ result_ref .sort_index ()
2160+ )
21512161
21522162 def test_series_value_counts_str_dropna_false (self ):
21532163 def test_impl (S ):
@@ -3933,7 +3943,10 @@ def test_impl_non_literal_kind(A, param_value):
39333943 np .unique (np .random .randint (0 , 100 , n )),
39343944 ['ac' , 'c' , 'cb' , 'ca' , None , 'da' , 'cc' , 'ddd' , 'd' ]
39353945 ]
3936- kind_values = ['quicksort' , 'mergesort' ]
3946+ kind_values = [
3947+ 'quicksort' ,
3948+ 'mergesort'
3949+ ]
39373950 for data in data_to_test :
39383951 S = pd .Series (data = data )
39393952 for kind in kind_values :
@@ -4013,6 +4026,7 @@ def test_impl(series, ascending, kind):
40134026 np .testing .assert_array_equal (ref_result .data , jit_result .data )
40144027 self .assertEqual (ref , jit )
40154028
4029+ @skip_numba_jit ("BUG: sort with kind=mergesort, ascending=False not stable for string data (SAT-3828)" )
40164030 def test_series_sort_values_full_unicode4 (self ):
40174031 def test_impl (series , ascending , kind ):
40184032 return series .sort_values (axis = 0 , ascending = ascending , kind = literally (kind ), na_position = 'last' )
@@ -4023,17 +4037,17 @@ def test_impl(series, ascending, kind):
40234037
40244038 for data in all_data :
40254039 series = pd .Series (data * 3 )
4026- for ascending in [True , False ]:
4027- for kind in ['quicksort' , 'mergesort' ]:
4028- ref_result = test_impl (series , ascending , kind = kind )
4029- jit_result = hpat_func (series , ascending , kind = kind )
4030- ref = restore_series_sort_values (series , ref_result .index , ascending )
4031- jit = restore_series_sort_values (series , jit_result .index , ascending )
4040+ for ascending , kind in product ([True , False ], ['quicksort' , 'mergesort' ]):
4041+ with self .subTest (data = data , ascending = ascending , kind = kind ):
4042+ result = hpat_func (series , ascending , kind = kind )
4043+ result_ref = test_impl (series , ascending , kind = kind )
40324044 if kind == 'mergesort' :
4033- pd .testing .assert_series_equal (ref_result , jit_result )
4045+ pd .testing .assert_series_equal (result , result_ref )
40344046 else :
4035- np .testing .assert_array_equal (ref_result .values , jit_result .values )
4036- self .assertEqual (ref , jit )
4047+ np .testing .assert_array_equal (result .values , result_ref .values )
4048+ jit = restore_series_sort_values (series , result .index , ascending )
4049+ ref = restore_series_sort_values (series , result_ref .index , ascending )
4050+ self .assertEqual (jit , ref )
40374051
40384052 @skip_parallel
40394053 def test_series_sort_values_full_idx (self ):
@@ -5316,6 +5330,7 @@ def test_impl(A, i, value):
53165330 test_impl (S2 , idx , value )
53175331 pd .testing .assert_series_equal (S1 , S2 )
53185332
5333+ @unittest .expectedFailure # FIXME_Pandas#37427 (since pandas=1.1 setitem does diff things for diff dtypes)
53195334 def test_series_setitem_idx_str_series (self ):
53205335 """ Verifies Series.setitem for idx operand of type pandas.Series and string dtype called on
53215336 integer Series with index of matching dtype and scalar and non scalar assigned values """
@@ -5331,6 +5346,7 @@ def test_series_setitem_idx_str_series(self):
53315346 pd .Series (assigned_values )]
53325347 self ._test_series_setitem ([series_data ], [series_index ], [idx ], values_to_test , np .intp )
53335348
5349+ @unittest .expectedFailure # FIXME_Pandas#37427 (since pandas=1.1 setitem does diff things for diff dtypes)
53345350 def test_series_setitem_idx_float_series (self ):
53355351 """ Verifies Series.setitem for idx operand of type pandas.Series and float dtype called on
53365352 integer Series with index of matching dtype and scalar and non scalar assigned values """
0 commit comments