parent
1a9483f3cf
commit
6bcb88f42d
@ -0,0 +1,19 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import matplotlib
|
||||||
|
|
||||||
|
# 设置默认字体以支持中文
|
||||||
|
matplotlib.rcParams['font.sans-serif'] = ['Microsoft YaHei']
|
||||||
|
|
||||||
|
# 读取 Excel 文件
|
||||||
|
df = pd.read_excel('danmu_statistics.xlsx', sheet_name='AI 技术关键词')
|
||||||
|
|
||||||
|
# 数据在名为 '关键词' 和 '出现次数' 的列中
|
||||||
|
categories = df['关键词']
|
||||||
|
values = df['出现次数']
|
||||||
|
|
||||||
|
# 绘制饼状图
|
||||||
|
plt.figure(figsize=(8, 6))
|
||||||
|
plt.pie(values, labels=categories, autopct='%1.1f%%', startangle=140)
|
||||||
|
plt.title('AI 技术各关键词占比')
|
||||||
|
plt.show()
|
Loading…
Reference in new issue