fix append error and decimal regex
This commit is contained in:
@@ -184,16 +184,16 @@ def performance(request):
|
||||
|
||||
def extract_numbers(s):
|
||||
if "HB" in s:
|
||||
match = re.search(r'-(\d+)$', s)
|
||||
match = re.search(r'-([\d.]+)$', s)
|
||||
else:
|
||||
match = re.search(r'-(\d+)', s) or re.search(r'(\d+)', s)
|
||||
match = re.search(r'-([\d.]+)', s) or re.search(r'([\d.]+)', s)
|
||||
|
||||
if match:
|
||||
return int(match.group(1))
|
||||
return float(match.group(1))
|
||||
else:
|
||||
return None
|
||||
|
||||
df["concentration"] = df['name'].apply(extract_numbers)
|
||||
df["concentration"] = df['name'].apply(extract_numbers)
|
||||
df['absorbance'] = df.apply(lambda row: row['led1Average'] if row['solution'] == 'Tartrazine' else row['led3Average'], axis=1)
|
||||
|
||||
df_precision_acc = df[["deviceId", "solution", "concentration", "led1Average", "led3Average", "absorbance"]].groupby(["deviceId", "solution", "concentration"]).describe()["absorbance"][["count", "min", "max", "mean"]]
|
||||
|
||||
Reference in New Issue
Block a user