wip
This commit is contained in:
@@ -37,7 +37,9 @@ def main(folder, intervl):
|
||||
newposts = dmt(posts).filter(lambda p: option_date_from <= p['CreationDate'] < option_date_to, "filtering posts by date").getresults()
|
||||
questionsininterval.append(((option_date_from, option_date_to), len(newposts)))
|
||||
newanswers = dmt(posts).map(lambda p: [a for a in p['Answers'] if option_date_from <= a['CreationDate'] < option_date_to], "filtering answers by date") \
|
||||
.reduce(lambda a, b: a + b, lambda a, b: a + b, lambda: []).getresults()
|
||||
.filter(lambda a: a != [], "filter out empty answer list").getresults()
|
||||
print('collecting answers')
|
||||
newanswers = [e for l in newanswers for e in l]
|
||||
answersininterval.append(((option_date_from, option_date_to), len(newanswers)))
|
||||
|
||||
postcounts = defaultdict(list)
|
||||
@@ -153,7 +155,7 @@ def main(folder, intervl):
|
||||
fig.savefig(outputdir + "postsanswers-i" + str(intervl) + ".png", bbox_inches='tight')
|
||||
plt.close(fig)
|
||||
|
||||
#print data set stats
|
||||
# print data set stats
|
||||
stats = ""
|
||||
stats += "users: " + str(len(users)) + "\n"
|
||||
stats += "questions: " + str(len(posts)) + "\n"
|
||||
@@ -169,6 +171,7 @@ def main(folder, intervl):
|
||||
with open(outputdir + "/stats.txt", "w") as file:
|
||||
file.write(stats)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# execute only if run as a script
|
||||
usage = sys.argv[0] + " <folder>"
|
||||
|
||||
Reference in New Issue
Block a user