79431389

Date: 2025-02-11 21:46:13
Score: 1
Natty:
Report link

The answer is:

def filter_sort_explicit(df, c, l):
    """
    a function that filters a [df] on [c]olumn by explicitly specificying the order of the values (in that column) in a [list]
    """
    return df.filter(pl.col(c).is_in(l)).sort(pl.col(c).cast(pl.Enum(l)))
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: likethevegetable