seqme.top_k

Contents

seqme.top_k#

seqme.top_k(df, metric, k, *, criteria='best', level=0, keep='all')[source]#

Extract top-k rows of the metric dataframe based on a metrics values.

Parameters:
  • df (DataFrame) – Metric dataframe.

  • metric (str) – Metric to consider when selecting top-k rows.

  • k (int) – Number of rows to extract.

  • criteria (Literal['best', 'worst']) – Criteria for top sequences.

  • level (int) – The tuple index-names level to consider as a group.

  • keep (Literal['first', 'last', 'all']) – Which entry to keep if multiple are equally good.

Return type:

DataFrame

Returns:

A subset of the metric dataframe with the top-k rows.