開始使用免費開始

驗證載入到 Postgres 資料庫的資料

在這個練習中,你將完整打造一個端到端的資料管線。這個管線會從 JSON 檔案擷取學校測驗分數,並在轉換時移除分數遺漏的列。此外,會依照學校所在城市,根據總分為每所學校排名。最後,轉換後的資料集會被儲存到 Postgres 資料庫。

為了幫你開個頭,extract()transform() 函式已經建立並如下使用。同時也已將 pandas 匯入為 pd。祝你順利!

# Extract and clean the testing scores.
raw_testing_scores = extract("testing_scores.json")
cleaned_testing_scores = transform(raw_testing_scores)

本練習屬於課程

使用 Python 的 ETL 與 ELT

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

def load(clean_data, con_engine):
	# Store the data in the schools database
    clean_data.____(
    	name="scores_by_city",
		con=con_engine,
		____="____",  # Make sure to replace existing data
		index=True,
		index_label="school_id"
    )
編輯並執行程式碼