Corey Morris commited on
Commit
31bed1a
1 Parent(s): 05f9c9a

Moved rank data into a separate method and dataframe

Browse files
Files changed (1) hide show
  1. result_data_processor.py +10 -0
result_data_processor.py CHANGED
@@ -11,6 +11,7 @@ class ResultDataProcessor:
11
  self.directory = directory
12
  self.pattern = pattern
13
  self.data = self.process_data()
 
14
 
15
  @staticmethod
16
  def _find_files(directory, pattern):
@@ -94,6 +95,15 @@ class ResultDataProcessor:
94
  data = data[cols]
95
 
96
  return data
 
 
 
 
 
 
 
 
 
97
 
98
  def get_data(self, selected_models):
99
  return self.data[self.data.index.isin(selected_models)]
 
11
  self.directory = directory
12
  self.pattern = pattern
13
  self.data = self.process_data()
14
+ self.ranked_data = self.rank_data()
15
 
16
  @staticmethod
17
  def _find_files(directory, pattern):
 
95
  data = data[cols]
96
 
97
  return data
98
+
99
+ def rank_data(self):
100
+ # add rank for each column to the dataframe
101
+ # copy the data dataframe to avoid modifying the original dataframe
102
+ rank_data = self.data.copy()
103
+ for col in list(rank_data.columns):
104
+ rank_data[col + "_rank"] = rank_data[col].rank(ascending=False, method='min')
105
+
106
+ return rank_data
107
 
108
  def get_data(self, selected_models):
109
  return self.data[self.data.index.isin(selected_models)]