国勢調査ケーススタディ

Pythonで学ぶデータベース入門

Jason Myers

Co-Author of Essential SQLAlchemy and Software Engineer

国勢調査ケーススタディ

  • SQLAlchemy とデータベースの準備
  • データをデータベースに読み込み
  • クエリでデータサイエンスの課題を解く
Pythonで学ぶデータベース入門

パート1: SQLAlchemy とデータベースの準備

  • エンジンと MetaData オブジェクトを作成
from sqlalchemy import create_engine, MetaData
engine = create_engine('sqlite:///census_nyc.sqlite')
metadata = MetaData()
Pythonで学ぶデータベース入門

パート1: SQLAlchemy とデータベースの準備

  • census テーブルを作成して保存
from sqlalchemy import (Table, Column, String, 
       Integer, Decimal, Boolean)

employees = Table('employees', metadata, Column('id', Integer()), Column('name', String(255)), Column('salary', Decimal()), Column('active', Boolean()))
metadata.create_all(engine)
Pythonで学ぶデータベース入門

Let's practice!

Pythonで学ぶデータベース入門

Preparing Video For Download...