Private
Public Access
1
0

added check for non-empty dataframe

This commit is contained in:
sanderroosendaal
2016-10-31 15:32:53 +01:00
parent 49f93da544
commit 0b2fc89ffb

View File

@@ -793,10 +793,18 @@ def interactive_cum_flex_chart(theworkouts,promember=0,
if yparam2 != 'None':
thedata = thedata[thedata[csvcolumns[yparam2]] > 0]
# check if dataframe not empty
if thedata.empty:
return ['','<p>No non-zero data in selection</p>','','']
spm = thedata.ix[:,csvcolumns['spm']]
f = thedata['TimeStamp (sec)'].diff().mean()
if not np.isnan(f):
windowsize = 2*(int(10./(f)))+1
else:
windowsize = 5
if windowsize <= 3:
windowsize = 5
@@ -825,8 +833,8 @@ def interactive_cum_flex_chart(theworkouts,promember=0,
if xparam=='time':
xaxmax = x1.max()
xaxmin = x1.min()
xaxmax = get_datetimes([x1.max()])[0]
xaxmin = get_datetimes([x1.min()])[0]
xaxmax = get_datetimes([xaxmax],tzinfo=1)[0]
xaxmin = get_datetimes([xaxmin],tzinfo=1)[0]
x1 = get_datetimes(x1,tzinfo=1)
elif xparam=='distance':
xaxmax = x1.max()
@@ -1554,7 +1562,6 @@ def interactive_flex_chart2(id=0,promember=0,
y2 = y1
if xparam=='time':
xaxmax = x1.max()
xaxmin = x1.min()
xaxmax = get_datetimes([xaxmax],tzinfo=1)[0]