Skip to content

Commit 5aa7857

Browse files
committed
Minor correction in Kaggle output generation
1 parent f9d28a9 commit 5aa7857

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

py_css/interface/kaggle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def to_kaggle_format(df: pd.DataFrame) -> str:
2727
str
2828
The dataframe in the Kaggle submission format.
2929
"""
30-
# for each query, only keep the best 3 docnos
31-
df = df.groupby("qid").head(3)
30+
# for each query, only keep the best 3 docnos ranked by asceding rank
31+
df = df.groupby("qid").sort_values("rank").head(3)
3232

3333
output = "qid,docid\n"
3434
for _, row in df.iterrows():

0 commit comments

Comments
 (0)