The Relationship between news and stocks 12
2022. 7. 28. 23:41ㆍProject/뉴스기사로 인한 주가 등락 예측
728x90
반응형
코드
MySQL에 토큰화 데이터 저장
from tqdm import tqdm
import pandas as pd
import pymysql
conn = pymysql.connect(
user = 'stocks',
passwd = 'Stocks!',
host = "-",
port = 3306,
db = 'Data',
charset = 'utf8'
)
cur = conn.cursor()
for row in tqdm(news.itertuples()):
sql = (row[1], row[2], row[3], row[4], row[5])
cur.execute('INSERT IGNORE INTO Token (stock_id, text, date, token, label) VALUES (%s ,%s, %s, %s, %s)', sql)
conn.commit()
conn.close()
728x90
반응형
'Project > 뉴스기사로 인한 주가 등락 예측' 카테고리의 다른 글
The Relationship between news and stocks 14 (0) | 2022.08.02 |
---|---|
The Relationship between news and stocks 13 (0) | 2022.07.29 |
The Relationship between news and stocks 11 (0) | 2022.07.28 |
The Relationship between news and stocks 10 (0) | 2022.07.26 |
The Relationship between news and stocks 9 (0) | 2022.07.26 |