def pie_base() -> 'html': df = pd.read_csv('data3.csv', encoding='utf8') bar = ( Bar() .add_xaxis(['不限', '3-5年', '1-3年', '5-10年', '无经验', '一年以下', '10年以上']) .add_yaxis("职位数量", [6183, 5164, 4842, 1516, 366, 111, 34]) .set_global_opts(title_opts=opts.TitleOpts(title="工作经验-职位分布数量")) ) line = ( Line() .add_xaxis(['本科', '大专', '不限', '硕士', '博士', '中专']) .add_yaxis("职位数量", [9954, 3704, 3205, 1137, 88, 31]) .set_global_opts( title_opts=opts.TitleOpts(title="最低要求学历-职位分布数量", pos_top="50%"), legend_opts=opts.LegendOpts(pos_top="50%"), ) ) grid = ( Grid() .add(bar, grid_opts=opts.GridOpts(pos_bottom="60%", pos_right="0", height="30%")) .add(line, grid_opts=opts.GridOpts(pos_top="60%", pos_right="0", height="30%")) ) bar,line,grid.render("./templates/pie_base.html") with open("./templates/pie_base.html", encoding="utf8", mode="r") as f: pie_base = "".join(f.readlines()) return render_template('python_pie_base.html', the_pie_base=pie_base, )