Commit 968f547c authored by Marcel Henrik Schubert's avatar Marcel Henrik Schubert
Browse files

fixed stat stdev error with len>1

parent 6d8d204c
......@@ -79,7 +79,9 @@ for key in tweetInfo.keys():
amounts.append(tweetInfo[key]['amount'])
len_comp.extend(tweetInfo[key]['lengths'])
len_avg.append(mean(tweetInfo[key]['lengths']))
std_avg.append(stdev(tweetInfo[key]['lengths']))
if len(tweetInfo[key]['lengths']) >1:
std_avg.append(stdev(tweetInfo[key]['lengths']))
gender[tweetInfo[key]['gender']].append(tweetInfo[key]['lengths'])
subgroups[tweetInfo[key]['subgroup']].append(tweetInfo[key]['lengths'])
......@@ -91,14 +93,25 @@ stats = {}
avg = mean(amounts)
std = stdev(amounts)
len_avg_res = mean(len_comp)
len_std_res = stdev(len_comp)
if len(len_comp) >1:
len_std_res = stdev(len_comp)
else:
len_std_res = None
len_avg_avg = mean(len_avg)
len_std_avg = stdev(len_avg)
if len(len_std_avg) >1:
len_std_avg = stdev(len_avg)
else:
len_std_avg = None
len_mean_std = mean(std_avg)
len_std_std = stdev(std_avg)
if len(len_std_std) >1:
len_std_std = stdev(std_avg)
else:
len_std_std = None
stats['numTweets_avg_overall'] = avg
stats['numTweets_std_overall'] = std
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment