@@ -332,24 +332,32 @@ def test_pct_max_many_rows(self):
332
332
333
333
def test_rank_minus_inf_keep_nan (self ):
334
334
# GH 32593
335
- expected_df = DataFrame ({'col' : np .array ([2.0 , 4.0 , np .nan , 3.0 , 1.0 ])})
336
- result_df = DataFrame ({'col' : np .array ([1 , np .inf , np .nan , 10 , - np .inf ])}).rank (na_option = 'keep' )
335
+ expected_df = DataFrame ({"col" : np .array ([2.0 , 4.0 , np .nan , 3.0 , 1.0 ])})
336
+ result_df = DataFrame ({"col" : np .array ([1 , np .inf , np .nan , 10 , - np .inf ])}).rank (
337
+ na_option = "keep"
338
+ )
337
339
tm .assert_frame_equal (expected_df , result_df )
338
340
339
341
def test_rank_inf_keep_nan (self ):
340
342
# GH 32593
341
- expected_df = DataFrame ({'col' : np .array ([1.0 , 2.0 , 3.0 ])})
342
- result_df = DataFrame ({'col' : np .array ([- np .inf , 0 , np .inf ])}).rank (na_option = 'keep' )
343
+ expected_df = DataFrame ({"col" : np .array ([1.0 , 2.0 , 3.0 ])})
344
+ result_df = DataFrame ({"col" : np .array ([- np .inf , 0 , np .inf ])}).rank (
345
+ na_option = "keep"
346
+ )
343
347
tm .assert_frame_equal (expected_df , result_df )
344
348
345
349
def test_rank_inf_bottom_nan (self ):
346
350
# GH 32593
347
- expected_df = DataFrame ({'col' : np .array ([1.0 , 2.0 , 4.0 , 3.0 ])})
348
- result_df = DataFrame ({'col' : np .array ([- np .inf , 0 , np .nan , np .inf ])}).rank (na_option = 'bottom' )
351
+ expected_df = DataFrame ({"col" : np .array ([1.0 , 2.0 , 4.0 , 3.0 ])})
352
+ result_df = DataFrame ({"col" : np .array ([- np .inf , 0 , np .nan , np .inf ])}).rank (
353
+ na_option = "bottom"
354
+ )
349
355
tm .assert_frame_equal (expected_df , result_df )
350
356
351
357
def test_rank_inf_decimal_nan (self ):
352
358
# GH 32593
353
- expected_df = DataFrame ({'col' : np .array ([2.0 ,3.0 ,4.5 ,6.0 ,1.0 ,4.5 ])})
354
- result_df = DataFrame ({'col' : np .array ([5.5 , 6.99 , np .inf , np .nan , 0.7 , np .inf ])}).rank (na_option = 'bottom' )
355
- tm .assert_frame_equal (expected_df , result_df )
359
+ expected_df = DataFrame ({"col" : np .array ([2.0 , 3.0 , 4.5 , 6.0 , 1.0 , 4.5 ])})
360
+ result_df = DataFrame (
361
+ {"col" : np .array ([5.5 , 6.99 , np .inf , np .nan , 0.7 , np .inf ])}
362
+ ).rank (na_option = "bottom" )
363
+ tm .assert_frame_equal (expected_df , result_df )
0 commit comments