Private
Public Access
1
0

improved filtering for Colin

This commit is contained in:
Sander Roosendaal
2020-03-18 07:49:38 +01:00
parent ff35c8062b
commit 3bcd14342a
2 changed files with 10 additions and 0 deletions

View File

@@ -483,6 +483,9 @@ def df_resample(datadf):
def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True, def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
ignoreadvanced=False): ignoreadvanced=False):
# clean data remove zeros and negative values # clean data remove zeros and negative values
before = len(datadf)
data_orig = datadf.copy()
# bring metrics which have negative values to positive domain # bring metrics which have negative values to positive domain
if len(datadf)==0: if len(datadf)==0:
@@ -706,6 +709,12 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
except: except:
pass pass
after = len(datadf.dropna())
ratio = float(after)/float(before)
if ratio < 0.001 or after < 2:
return data_orig
return datadf return datadf
def getstatsfields(): def getstatsfields():

View File

@@ -3715,6 +3715,7 @@ def interactive_flex_chart2(id=0,promember=0,
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True, rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly)
if len(rowdata)<2: if len(rowdata)<2:
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True, rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
workstrokesonly=False) workstrokesonly=False)