# 機器學習導論 Assignment 1 補充資料如何取得及吃進 Python ### **Step1** [點選網址](https://lvr.land.moi.gov.tw/) 進入網址,你會看到以下頁面  ### **Step 2** 選取自己想要的小區及時段,按下搜尋,如圖 :point_down:   ### **Step 3** 按下列印,載前1500筆資料,並且重複做剪貼的動作,以台中市梧棲區為例,大致上需要三次檔案下載。  ### **Step 4** 另存新檔,只留一些可能有需要的資訊,存成 **csv**檔  ### **Step 5** 讀進 Python,先 import pandas,然後使用 pandas.read_csv("檔名.csv"),如下程式碼: ```python= import numpy as np import matplotlib.pyplot as plt import pandas as pd rowData=pd.read_csv("fix House Price.csv") ``` 建議可以多看看吃進來的資料是不是符合預期 :::warning 值得注意的是:price欄位是有逗點的,所以需要做資料整理的動作,將其轉為 float 型態,並把逗點去除。 :::  :::success :bulb: 解決方法: ```python= # turn and clean the data into float def clean(data): data=data.values.tolist() for ii in range(len(data)): data[ii]=data[ii].replace(",","") data[ii]=float(data[ii]) return data ``` 結果:  ::: :::info :question: 如果直接吃未整理過的檔案會發生什麼事情 Case 1:   Case 2:  :bulb: 還是傾向用整理過的資料比較安全 ::: 緊接著便可以進行一系列的分析~ <font size=1>文末~</font> ###### tags: `補充`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up