0
1

More than 3 years have passed since last update.

超初心者がMySQLに保存した1分足データを取得してみた

Posted at

参考

以下で保存したデータを今度は取得してみる

コード

select_histdata_from_table.py
import mysql.connector as mydb
import pandas as pd

conn = mydb.connect(
    host='hostname',
    port='3306',
    user='user',
    password='pass',
    database='fx'
)

conn.ping(reconnect=True)
cursor = conn.cursor()

df = pd.read_sql_query(sql='select * from usdjpy where date between "2021-01-01" and "2021-03-31"', con=conn)

df['date'] = pd.to_datetime(df.date)
df.set_index('date', inplace=True)

print(df.head())

完走した感想

簡単すぎィィィィ

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1