File size: 901 Bytes
963c6da
fbcd930
 
963c6da
fbcd930
 
 
 
 
 
 
 
 
 
 
963c6da
fbcd930
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
import pandas as pd

@st.cache_data
def load_dataframe() -> pd.DataFrame:
    """
    Load dataframe from the csv file in public directory
    Returns
    dataframe: a pd.DataFrame of the average scores of the LLMs on each task
    """

    dataframe = pd.read_csv("public/datasets/models_scores.csv")
    dataframe = dataframe.drop(columns = "Unnamed: 0")
    return dataframe

@st.cache_data
def sort_by(dataframe: pd.DataFrame, column_name: str, ascending:bool = False) -> pd.DataFrame:
    """
    Sort the dataframe by column_name
    
    Arguments:
    - dataframe: a pandas dataframe to sort
    - column_name: a string stating the column to sort the dataframe by
    - ascending: a boolean stating to sort in ascending order or not, default to False

    Returns:
    a sorted dataframe
    """
    return dataframe.sort_values(by = column_name, ascending = ascending )