因此,我尝试使用openpyxl库来用标记制作一行。数据集如下:
df = [['System1 Account Unlock','week 1',1],
['System2 Password Reset','week 1',2],
['Website','week 1',3],
['System2 (problem)','week 2',1],
['System1 Password Reset','week 2',2],
['Website','week 2',1],
['System2 Password Reset','week 3',2],
['Website','week 3',5],
['System2 (problem)','week 3',1],
['System1 Password Reset','week 4',2],
['System1 Account Unlock','week 4',2],
['Website','week 4',2],
['System2 (problem)','week 4',4],
['System2 Password Reset','week 4',4],
['Website','week 5',1],
['System1 Password Reset','week 5',1],
['System1 Account Unlock','week 5',2]]
然后我将这些值粘贴到名为“ ws”的工作表上。
然后我用:
xvalues = Reference(ws, min_col=2, min_row=1, max_col=2, max_row=17)
yvalues = Reference(ws, min_col=3, min_row=1, max_col=3, max_row=17)
legend_values = Reference(ws, min_col=1, min_row=1, max_col=1, max_row=17)
要获取列,使其看起来像这样:
“ >>
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9wYXN0ZWJvYXJkLmNvL0lUVnJlYWMucG5nIn0=” alt =“ EXCEL参考”>
我尝试过:-使用Series类但添加x,y和图例,但结果是1行而不是多行-使用折线图,但产生了1条线-删除图例和y,然后立即抛出所有数据...结果是名为Series 1和Series 2的2行,而不是在图片中]
我需要帮助以df [0]或类别为图例标记,df [1]或周为x轴,而df [2]或事件数为y轴来制作图形
因此,我尝试使用openpyxl库来用标记制作一行。数据集,例如:df = [['System1帐户解锁','第1周',1],['System2密码重置','第1周',2],['网站','第1周',3],[ 'System2 ...
首先,我使数据在工作表中看起来像这样:
col1 col2 col3 col4
week 1 5 8 0 15
week 2 6 7 1 6
week 3 1 7 4 2
week 4 4 0 0 0
week 5 0 0 0 0