Private
Public Access
1
0

adding code to pass tests (cleaning)

This commit is contained in:
Sander Roosendaal
2020-12-28 17:23:13 +01:00
parent 3deb558050
commit c497e17f1f
2 changed files with 9 additions and 4 deletions

View File

@@ -546,6 +546,11 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
ignoreadvanced=False):
# clean data remove zeros and negative values
try:
workoutids = datadf['workoutid'].unqiue()
except (KeyError,AttributeError):
datadf['workoutid'] = 0
before = {}
for workoutid in datadf['workoutid'].unique():
before[workoutid] = len(datadf[datadf['workoutid']==workoutid])
@@ -798,7 +803,7 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
for workoutid in data_orig['workoutid'].unique():
after[workoutid] = len(datadf[datadf['workoutid']==workoutid].dropna())
ratio = float(after[workoutid])/float(before[workoutid])
if ratio < 0.01 or after < 2:
return data_orig