我使用MySQLdb建立了到SQL数据库的连接。 然后我用
Cursor = connection.cursor()
anz = Cursor.execute(myquery)
然后我用它做了一个数据帧
df = DataFrame(anz, columns = ['likeval','count'])
然后我画了出来
df.plot(kind='hist', x='Anzahl', y='count')
我进口了MySQLdb,熊猫和matplotlib.pyplot文件你知道吗
所以现在我想知道我是怎么通过电子邮件把这个情节发给别人的。 我想用相同的代码来做,不想保存图形。你知道吗
首先,您需要将图形保存到虚拟文件对象:
现在,
f
包含图像数据,可以像文件一样read
:接下来,让我们创建电子邮件:
通过电子邮件发送图像有两个选项:
<img>
标记中方案1:
方案2:
最后,发送电子邮件:
注意:我还没有测试这些,但他们应该不会太远的工作。你知道吗
相关问题 更多 >
编程相关推荐