def get_msg_star(name): path = r"C:\Users\17998\Desktop\MCM_ICN" + "\\" + name + ".xlsx" most = get_10_most_popular(read_excel(name)) msgs = [] for i in range(len(most)): msgs.append(xls_select_star(path, most[i][0])) return msgs
def get_msg_year(name): path = r"C:\Users\17998\Desktop\MCM_ICN" + "\\" + name + ".xlsx" years = range(9, 19) most = get_10_most_popular(read_excel(name)) msgss = [] for i in range(len(most)): msgs = [] for year in years: msgs.append(xls_select_year(path, most[i][0], str(year))) msgss.append(msgs) return msgss
def draw_pic(combine_grade, name): x = range(2009, 2019) plt.figure(1) most = get_10_most_popular(read_excel(name)) for i in range(len(combine_grade)): plt.plot(x, combine_grade[i], label=most[i][0]) plt.title("product evaluation trend") plt.xlabel("years") plt.ylabel("evaluation") plt.legend() plt.show()
def cal_grades(name): msgs = get_msg(name) scores = [] for msg in msgs: scores.append(cal_grade(msg)) most = get_10_most_popular(read_excel(name)) sum_s = sum(scores) result = [] res_o = [] for i in range(len(most)): result.append((most[i][0], scores[i])) res_o.append((most[i][0], scores[i] / sum_s)) print(result) print(res_o) return result