@@ -96,63 +96,36 @@ def test_dataframe_groupby_quantile(scalars_df_index, scalars_pandas_df_index, q
96
96
97
97
98
98
@pytest .mark .parametrize (
99
- ("na_option" , "method" , "ascending" ),
99
+ ("na_option" , "method" , "ascending" , "pct" ),
100
100
[
101
101
(
102
102
"keep" ,
103
103
"average" ,
104
104
True ,
105
- ),
106
- (
107
- "top" ,
108
- "min" ,
109
- False ,
110
- ),
111
- (
112
- "bottom" ,
113
- "max" ,
114
- False ,
115
- ),
116
- (
117
- "top" ,
118
- "first" ,
119
- False ,
120
- ),
121
- (
122
- "bottom" ,
123
- "dense" ,
124
105
False ,
125
106
),
107
+ ("top" , "min" , False , False ),
108
+ ("bottom" , "max" , False , False ),
109
+ ("top" , "first" , False , True ),
110
+ ("bottom" , "dense" , False , True ),
126
111
],
127
112
)
128
113
def test_dataframe_groupby_rank (
129
- scalars_df_index ,
130
- scalars_pandas_df_index ,
131
- na_option ,
132
- method ,
133
- ascending ,
114
+ scalars_df_index , scalars_pandas_df_index , na_option , method , ascending , pct
134
115
):
135
116
# TODO: supply a reason why this isn't compatible with pandas 1.x
136
117
pytest .importorskip ("pandas" , minversion = "2.0.0" )
137
118
col_names = ["int64_too" , "float64_col" , "int64_col" , "string_col" ]
138
119
bf_result = (
139
120
scalars_df_index [col_names ]
140
121
.groupby ("string_col" )
141
- .rank (
142
- na_option = na_option ,
143
- method = method ,
144
- ascending = ascending ,
145
- )
122
+ .rank (na_option = na_option , method = method , ascending = ascending , pct = pct )
146
123
).to_pandas ()
147
124
pd_result = (
148
125
(
149
126
scalars_pandas_df_index [col_names ]
150
127
.groupby ("string_col" )
151
- .rank (
152
- na_option = na_option ,
153
- method = method ,
154
- ascending = ascending ,
155
- )
128
+ .rank (na_option = na_option , method = method , ascending = ascending , pct = pct )
156
129
)
157
130
.astype ("float64" )
158
131
.astype ("Float64" )
@@ -737,63 +710,51 @@ def test_series_groupby_agg_list(scalars_df_index, scalars_pandas_df_index):
737
710
738
711
739
712
@pytest .mark .parametrize (
740
- ("na_option" , "method" , "ascending" ),
713
+ ("na_option" , "method" , "ascending" , "pct" ),
741
714
[
742
- (
743
- "keep" ,
744
- "average" ,
745
- True ,
746
- ),
715
+ ("keep" , "average" , True , False ),
747
716
(
748
717
"top" ,
749
718
"min" ,
750
719
False ,
720
+ True ,
751
721
),
752
722
(
753
723
"bottom" ,
754
724
"max" ,
755
725
False ,
726
+ True ,
756
727
),
757
728
(
758
729
"top" ,
759
730
"first" ,
760
731
False ,
732
+ True ,
761
733
),
762
734
(
763
735
"bottom" ,
764
736
"dense" ,
765
737
False ,
738
+ False ,
766
739
),
767
740
],
768
741
)
769
742
def test_series_groupby_rank (
770
- scalars_df_index ,
771
- scalars_pandas_df_index ,
772
- na_option ,
773
- method ,
774
- ascending ,
743
+ scalars_df_index , scalars_pandas_df_index , na_option , method , ascending , pct
775
744
):
776
745
# TODO: supply a reason why this isn't compatible with pandas 1.x
777
746
pytest .importorskip ("pandas" , minversion = "2.0.0" )
778
747
col_names = ["int64_col" , "string_col" ]
779
748
bf_result = (
780
749
scalars_df_index [col_names ]
781
750
.groupby ("string_col" )["int64_col" ]
782
- .rank (
783
- na_option = na_option ,
784
- method = method ,
785
- ascending = ascending ,
786
- )
751
+ .rank (na_option = na_option , method = method , ascending = ascending , pct = pct )
787
752
).to_pandas ()
788
753
pd_result = (
789
754
(
790
755
scalars_pandas_df_index [col_names ]
791
756
.groupby ("string_col" )["int64_col" ]
792
- .rank (
793
- na_option = na_option ,
794
- method = method ,
795
- ascending = ascending ,
796
- )
757
+ .rank (na_option = na_option , method = method , ascending = ascending , pct = pct )
797
758
)
798
759
.astype ("float64" )
799
760
.astype ("Float64" )
0 commit comments