ich bin in python nicht so auf trap...
so hoffe ich Ihr könnt mir helfen.
Ich möchte so einfach wie möglich aus meiner mysql db werte auslesen (Datum und Temperaturdaten)
Mein Mysql script funktioniert einmal wunderbar.
Code: Alles auswählen
# MySQLdbTest.py
# simple example of MySQLdb
import MySQLdb
# starting connection to database
conn = MySQLdb.connect ("10.59.240.203", "*****", "*****", "*****")
# getting the cursor
cursor = conn.cursor()
# setting the statement
cursor.execute ("Select * from metadata")
# get all rows
rows = cursor.fetchall ()
# print all rows
for row in rows:
station = row[1]
print station
# close cursor
cursor.close()
#close connection
conn.close()
ausgelesenen daten dort einspiele :S (auf X achse das Datum und y Werte)
BSP CODE AUS MATLOT
Code: Alles auswählen
#!/usr/bin/env python
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(10000)
# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
# add a 'best fit' line
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
Falls es eine andere leichtere / unkompliziertere Methode gibt bin ich auch für diese offen es muss nicht unbedingt python sein.
MFG