最近あまりにも競馬に勝てないです。
なのでデータ分析ツールを作ろうと思います。
完成したらこのサイトで公開予定となります。
ツールの目的
自身の軸である相手関係の分析に過去データから根拠を持たせることができるようにする。
(既存のツールではできないことをできるようにする)
設計図
サーバー →リクエスト→ 出走馬の情報を持っているサイト
|
(情報取得) ←
↓
データ加工 →リクエスト→ DB
|
(情報取得) ←
↓
グラフ化
進捗状況:必要処理から定義中
↓
たたき台機能作成中
コードの一部
class Command(BaseCommand):
help = "CSVファイルから競馬データを取り込み、更新する"
def add_arguments(self, parser):
parser.add_argument('csv_file', type=str, help="インポートするCSVファイルのパス")
def handle(self, *args, **kwargs):
csv_file = kwargs['csv_file']
with open(csv_file, newline='', encoding='utf-8') as file:
reader = csv.DictReader(file)
for row in reader:
horse_id = row['horse_id']
defaults = {
"horse_name": row['horse_name'],
"finished_rank": float(row['finished_rank']),
"odds": float(row['odds']),
"popular": float(row['popular']),
"head_corner": int(row['head_corner']),
"tail_corner": int(row['tail_corner']),
"horse_weight": int(row['horse_weight']),
"course_len": int(row['course_len']),
"last_3F_time": float(row['last_3F_time']) if row['last_3F_time'] else None,
"information": row['information']
}