import numpy
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
from pandas import read_csv
import math
from keras.models import Sequential
from keras.layers import Dense
#from keras.layers import LSTM
from keras.layers import LSTM
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
import tensorflow as tf
import mysql.connector
import pymysql
import datetime
from datetime import datetime
def create_dataset(dataset, look_back=1):
dataX, dataY = [], []
for i in range(len(dataset)-look_back-1):
a = dataset[i:(i+look_back), 0]
dataX.append(a)
dataY.append(dataset[i + look_back, 0])
return numpy.array(dataX), numpy.array(dataY)
numpy.random.seed(7)
config = {
'user': 'root',
'password': '',
'host': 'localhost',
#'database': 'raspberrydb',
#'database': 'power_mysql,
'database':"pm",
#'raise_on_warnings': True,
}
cnx = pymysql.connect(**config)
cursor = cnx.cursor()
cursor.execute("SELECT * FROM pm_blockchain_data")
results = cursor.fetchall()
我這樣打哪之前都可以,但不知道現在為什麼有問題了
是MYSQL設定跑掉?
現在MYSQL無法連結我的資料庫
Traceback (most recent call last):
File "C:\TSVSELE_William\Python_code\110_1_27\LSTM_PM_2020_01_11_u4_e50.py", line 49, in
cursor.execute("SELECT * FROM pm_blockchain_data")