wefe.utils.create_ranking

wefe.utils.create_ranking(results_dataframes: List[DataFrame], method: str = 'first', ascending: bool = True) DataFrame[source]

Create a ranking form the aggregated scores of the provided dataframes.

The function will assume that the aggregated scores are in the last column of each result dataframe. It uses pandas.DataFrame.rank to generate the ranks.

Parameters
results_dataframesList[pd.DataFrame]

A list or array of dataframes returned by the run_queries function.

methodstr, optional

How to rank the group of records that have the same value, by default ‘first’. The options are: - average: average rank of the group - min: lowest rank in the group - max: highest rank in the group - first: ranks assigned in order they appear in the array - dense: like ‘min’, but rank always increases by 1 between groups.

ascendingbool, optional

Whether or not the elements should be ranked in ascending order, by default True.

Returns
pd.DataFrame

A dataframe with the ranked scores.

Raises
Exception

If there is no average column in some result Dataframe.

TypeError

If some element of results_dataframes is not a pandas DataFrame.