Skip to content

Commit

Permalink
precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
svittoz committed Apr 17, 2024
1 parent 3569ca3 commit 9c91724
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions eds_scikit/utils/sort_first_koalas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from eds_scikit.utils.typing import DataFrame
from typing import List

def sort_values_first_koalas(dataframe : DataFrame , by_cols : List[str], cols : List[str], ascending : bool = True) -> DataFrame:
from eds_scikit.utils.typing import DataFrame


def sort_values_first_koalas(
dataframe: DataFrame, by_cols: List[str], cols: List[str], ascending: bool = True
) -> DataFrame:
"""Replacement for dataframe.sort_values(cols).groupby(by_cols).first()
To get a deterministic first, provide an id column of your dataframe as the last element of cols.
Expand All @@ -17,7 +21,7 @@ def sort_values_first_koalas(dataframe : DataFrame , by_cols : List[str], cols :
-------
DataFrame
"""
"""
for col in cols:
dataframe_min_max = dataframe.groupby(by_cols, as_index=False)[col]
dataframe_min_max = (
Expand Down

0 comments on commit 9c91724

Please sign in to comment.