Private
Public Access
1
0
This commit is contained in:
2024-03-17 12:26:50 +01:00
parent bdaf5fada8
commit 1c4f6cc7ee
3 changed files with 14 additions and 12 deletions

View File

@@ -394,7 +394,7 @@ 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, for_chart=False):
# clean data remove zeros and negative values # clean data remove zeros and negative values
try: try:
@@ -643,7 +643,8 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
after = {} after = {}
return datadf if for_chart:
return datadf
for workoutid in data_orig['workoutid'].unique(): for workoutid in data_orig['workoutid'].unique():
after[workoutid] = len( after[workoutid] = len(
datadf[datadf['workoutid'] == workoutid].dropna()) datadf[datadf['workoutid'] == workoutid].dropna())
@@ -1212,7 +1213,7 @@ def testdata(time, distance, pace, spm): # pragma: no cover
def getrowdata_db(id=0, doclean=False, convertnewtons=True, def getrowdata_db(id=0, doclean=False, convertnewtons=True,
checkefficiency=True): checkefficiency=True, for_chart=False):
data = read_df_sql(id) data = read_df_sql(id)
try: try:
data['deltat'] = data['time'].diff() data['deltat'] = data['time'].diff()
@@ -1237,7 +1238,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True,
data = add_efficiency(id=id) data = add_efficiency(id=id)
if doclean: # pragma: no cover if doclean: # pragma: no cover
data = clean_df_stats(data, ignorehr=True) data = clean_df_stats(data, ignorehr=True, for_chart=for_chart)
return data, row return data, row
@@ -1245,7 +1246,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True,
def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, compute=True, def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, compute=True,
debug=False): debug=False, for_chart=False):
# prepmultipledata(ids) # prepmultipledata(ids)
if ids: if ids:
@@ -1312,7 +1313,8 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp
data = df.copy() data = df.copy()
if doclean: if doclean:
data = clean_df_stats(data, ignorehr=True, data = clean_df_stats(data, ignorehr=True,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly,
for_chart=for_chart)
data.dropna(axis=1, how='all', inplace=True) data.dropna(axis=1, how='all', inplace=True)
data.dropna(axis=0, how='all', inplace=True) data.dropna(axis=0, how='all', inplace=True)
return data return data

View File

@@ -3987,10 +3987,10 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
datadf = pd.DataFrame() datadf = pd.DataFrame()
if promember: if promember:
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly, for_chart=True)
else: else:
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, datadf = dataprep.getsmallrowdata_db(columns_basic, ids=ids, doclean=True,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly, for_chart=True)
try: try:
_ = datadf[yparam2] _ = datadf[yparam2]
@@ -5296,11 +5296,11 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
if promember: if promember:
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean, datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean,
compute=compute, compute=compute,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly, for_chart=True)
else: else:
datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean, datadf = dataprep.getsmallrowdata_db(columns_basic, ids=ids, doclean=doclean,
compute=compute, compute=compute,
workstrokesonly=workstrokesonly) workstrokesonly=workstrokesonly, for_chart=True)
datadf['workoutid'] = datadf['workoutid'].astype(int) datadf['workoutid'] = datadf['workoutid'].astype(int)
datadf.dropna(axis=1, how='all', inplace=True) datadf.dropna(axis=1, how='all', inplace=True)

Binary file not shown.