Handle accuracy data missing the spaces around +/-

#20
by nlamot - opened
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -167,14 +167,13 @@ def parse_rewards(accuracy):
167
  default_reward=-1000
168
  if accuracy != None:
169
  accuracy = str(accuracy)
170
- parsed = accuracy.split(' +/- ')
171
  if len(parsed)>1:
172
- mean_reward = float(parsed[0])
173
- std_reward = float(parsed[1])
174
- elif len(parsed)==1: #only mean reward
175
- mean_reward = float(parsed[0])
176
- std_reward = float(0)
177
-
178
  else:
179
  mean_reward = float(default_std)
180
  std_reward = float(default_reward)
 
167
  default_reward=-1000
168
  if accuracy != None:
169
  accuracy = str(accuracy)
170
+ parsed = accuracy.split('+/-')
171
  if len(parsed)>1:
172
+ mean_reward = float(parsed[0].strip())
173
+ std_reward = float(parsed[1].strip())
174
+ elif len(parsed)==1: #only mean reward
175
+ mean_reward = float(parsed[0].strip())
176
+ std_reward = float(0)
 
177
  else:
178
  mean_reward = float(default_std)
179
  std_reward = float(default_reward)