arshy commited on
Commit
bfc0501
·
1 Parent(s): 8eba8ff

improvements

Browse files
Files changed (2) hide show
  1. tabs/error.py +8 -8
  2. tabs/tool_win.py +8 -8
tabs/error.py CHANGED
@@ -6,18 +6,18 @@ from typing import List
6
  HEIGHT=600
7
  WIDTH=1000
8
 
9
- def set_error(row: pd.Series) -> bool:
10
- """Sets the error for the given row."""
11
- if row.error not in [True, False]:
12
- if not row.prompt_response:
13
- return True
14
- return False
15
- return row.error
16
 
17
  def get_error_data(tools_df: pd.DataFrame, inc_tools: List[str]) -> pd.DataFrame:
18
  """Gets the error data for the given tools and calculates the error percentage."""
19
  tools_inc = tools_df[tools_df['tool'].isin(inc_tools)]
20
- tools_inc['error'] = tools_inc.apply(set_error, axis=1)
21
  error = tools_inc.groupby(['tool', 'request_month_year_week', 'error']).size().unstack().fillna(0).reset_index()
22
  error['error_perc'] = (error[True] / (error[False] + error[True])) * 100
23
  error['total_requests'] = error[False] + error[True]
 
6
  HEIGHT=600
7
  WIDTH=1000
8
 
9
+ # def set_error(row: pd.Series) -> bool:
10
+ # """Sets the error for the given row."""
11
+ # if row.error not in [True, False]:
12
+ # if not row.prompt_response:
13
+ # return True
14
+ # return False
15
+ # return row.error
16
 
17
  def get_error_data(tools_df: pd.DataFrame, inc_tools: List[str]) -> pd.DataFrame:
18
  """Gets the error data for the given tools and calculates the error percentage."""
19
  tools_inc = tools_df[tools_df['tool'].isin(inc_tools)]
20
+ # tools_inc['error'] = tools_inc.apply(set_error, axis=1)
21
  error = tools_inc.groupby(['tool', 'request_month_year_week', 'error']).size().unstack().fillna(0).reset_index()
22
  error['error_perc'] = (error[True] / (error[False] + error[True])) * 100
23
  error['total_requests'] = error[False] + error[True]
tabs/tool_win.py CHANGED
@@ -7,19 +7,19 @@ HEIGHT=600
7
  WIDTH=1000
8
 
9
 
10
- def set_error(row: pd.Series) -> bool:
11
- """Sets the error for the given row."""
12
- if row.error not in [True, False]:
13
- if not row.prompt_response:
14
- return True
15
- return False
16
- return row.error
17
 
18
 
19
  def get_tool_winning_rate(tools_df: pd.DataFrame, inc_tools: List[str]) -> pd.DataFrame:
20
  """Gets the tool winning rate data for the given tools and calculates the winning percentage."""
21
  tools_inc = tools_df[tools_df['tool'].isin(inc_tools)]
22
- tools_inc['error'] = tools_inc.apply(set_error, axis=1)
23
  tools_non_error = tools_inc[tools_inc['error'] != True]
24
  tools_non_error.loc[:, 'currentAnswer'] = tools_non_error['currentAnswer'].replace({'no': 'No', 'yes': 'Yes'})
25
  tools_non_error = tools_non_error[tools_non_error['currentAnswer'].isin(['Yes', 'No'])]
 
7
  WIDTH=1000
8
 
9
 
10
+ # def set_error(row: pd.Series) -> bool:
11
+ # """Sets the error for the given row."""
12
+ # if row.error not in [True, False]:
13
+ # if not row.prompt_response:
14
+ # return True
15
+ # return False
16
+ # return row.error
17
 
18
 
19
  def get_tool_winning_rate(tools_df: pd.DataFrame, inc_tools: List[str]) -> pd.DataFrame:
20
  """Gets the tool winning rate data for the given tools and calculates the winning percentage."""
21
  tools_inc = tools_df[tools_df['tool'].isin(inc_tools)]
22
+ # tools_inc['error'] = tools_inc.apply(set_error, axis=1)
23
  tools_non_error = tools_inc[tools_inc['error'] != True]
24
  tools_non_error.loc[:, 'currentAnswer'] = tools_non_error['currentAnswer'].replace({'no': 'No', 'yes': 'Yes'})
25
  tools_non_error = tools_non_error[tools_non_error['currentAnswer'].isin(['Yes', 'No'])]