import pandas as pd from pyecharts.charts import WordCloud from pyecharts import options as opts data = pd.read_csv("最新数据.csv") hy = data[['职位名称','行业']] hangye = hy.groupby('行业').count() x_data = hangye.index.tolist() y_data = hangye['职位名称'].tolist() hy_data = [i for i in zip(x_data,y_data)] # 绘制行业词云图 wc = WordCloud()\ .add(series_name="行业词云图",data_pair=hy_data)\ .set_global_opts(title_opts=opts.TitleOpts('行业类型词云图',pos_left="45%",pos_top="7%")) wc.render('行业词云图.html')