I made a code that takes data from the DB to generate a graph with matplotlib , but the data in the DB is as varchar
and for data creation it must be in the format% with%. How can I do the conversion?
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import matplotlib.pyplot as plt
print(plt)
con = mdb.connect('localhost', 'root', '123456', 'testdb');
null = None
with con:
cur = con.cursor()
d = cur.execute("SELECT Ping FROM Pings WHERE Enderecos = 'www.peplink.com'")
d = cur.fetchall()
plt.plot(d)
plt.title("Peplink")
plt.show()