Private
Public Access
1
0

small play with the algo

This commit is contained in:
Sander Roosendaal
2021-01-06 08:34:44 +01:00
parent 0cec60d063
commit d850ec4305

View File

@@ -106,7 +106,7 @@ from pandas.core.groupby.groupby import DataError
def newtestpower(x):
try:
if abs(x['testpower'] - x['testdup']) < 0.2:
if abs(x['testpower'] - x['testdup']) <= 0.2:
return np.nan
except (AttributeError,TypeError):
return np.nan
@@ -198,18 +198,19 @@ def build_goldmedalstandards(workouts,kfitness):
# fitnesses.append(np.nan)
for w in workouts:
ids = [w.id for w in workouts.filter(date__gte=w.date-datetime.timedelta(days=42),
ids = [ww.id for ww in workouts.filter(date__gte=w.date-datetime.timedelta(days=42),
date__lte=w.date)]
powerdf = df[df['workout'].isin(ids)]
indexmax = powerdf['goldmedalstandard'].idxmax()
theid = powerdf.loc[indexmax,'workout']
powertest = powerdf['goldmedalstandard'].max()
durationtest = powerdf.loc[indexmax,'goldmedalduration']
dates.append(arrow.get(w.date).datetime)
w2 = Workout.objects.get(id=theid)
dates.append(arrow.get(w2.date).datetime)
if powertest > 0:
testpower.append(powertest)
testduration.append(durationtest)