ich bekomme folgende Meldung finde aber den Fehler nicht...
Code: Alles auswählen
raise errors.ProgrammingError(
mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python 'series' cannot be converted to a MySQL type
Code: Alles auswählen
import finanzen_fundamentals.stocks as ff
import mysql.connector
import pandas as pd
mydb = mysql.connector.connect( host="localhost", user="USER", password="PASSWORD", database="stockdata")
mycursor = mydb.cursor()
mycursor.execute("select * from url_name")
record = mycursor.fetchall()
sql = "INSERT INTO stock_price (NAME, WKN, ISIN, TIME, PRICE, CURRENCY, EXCHANGE) VALUES (%s, %s, %s, %s, %s, %s, %s)"
for row in record:
try:
df = ff.get_current_value_lxml(str(row[2])[:-1], exchange = "FSE")
val = (df["name"], df["wkn"], df["isin"], df["time"], df["price"], df["currency"], df["exchange"])
print(val)
mycursor.execute(sql, val)
mydb.commit()
print("Insertet: " + str(df["name"]))
except Exception as e:
print("Error at stock: " + str(row[2]))
print(str(e))
(0 BMW Aktie
Name: name, dtype: object, 0 519000
Name: wkn, dtype: object, 0 DE0005190003
Name: isin, dtype: object, 0 16.10.2020
Name: time, dtype: object, 0 62.84
Name: price, dtype: float64, 0 EUR
Name: currency, dtype: object, 0 Stuttgard
Name: exchange, dtype: object)
ist es ein fehler wegem diesem 0 als Index, der Rest würde ja passen...
Gruß
Tom