Pandas Data frame of Python === 王辰禎, DCT, NTCU(Taiwan) --- ###### tags: `python` `package` `package` `pip` `Data Frame` `numpy` **資料科學與問題解決week04HW(3/14) : 課本作業p2-25 習題3** [Golab 程式碼](https://colab.research.google.com/drive/1mJgTJ98sDZow7w_h7kny9Ue0fowhC1qU?usp=sharing) --- #### **If you use python IDLE from python.org, you should use CMD and pip to install the pandas package.**  ##### 用命令提示字元確認python與pip的版本,讀不到請參考以下影片處理 語法:`pip -V`、`python -V`或`pip --version`  <iframe width="560" height="315" src="https://www.youtube.com/embed/FYkOr_7hOXw?si=yeAgmPRfW8YJsJDr" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> ##### install the pandas package 1. open the cmd(命令提示字元) 2. 輸入 `pip install pandas`  --- #### <正文>import(匯入)套件,e.g. random、math套件等等  --- #### 將題目的資料丟進Data Frame,並加上index  --- #### 1.將English中'90'改為90。  將該格轉成數值型態int([內容]) 用type()確認型態是否轉變 輸出Data Frame --- #### 2.將History中的188改為88 兩種方法抓Data Frame的某值(某格) ##### (1).df.iloc[ [列索引值], [行索引值] ] ##### (2).df.loc[ [列的名稱], [行的名稱] ] 這裡用df.iloc處理  輸出Data Frame --- #### 3.將nan改為各欄的平均值 ##### (1).df.iloc[ [列索引值], [行索引值] ] ##### (2).df.loc[ [列的名稱], [行的名稱] ] 這裡用df.loc處理  輸出Data Frame ##### 看到小數點太多->四捨五入  --- #### 參考資料 : ###### [(aws.amazon)在 Windows 上安裝 Python、pip 和 EB CLI](https://docs.aws.amazon.com/zh_tw/elasticbeanstalk/latest/dg/eb-cli3-install-windows.html) ###### [(medium.com)[Python資料科學]pandas基礎介紹-進入資料科學的領域](https://medium.com/seaniap/pandas%E5%9F%BA%E7%A4%8E%E4%BB%8B%E7%B4%B9-%E9%80%B2%E5%85%A5%E8%B3%87%E6%96%99%E7%A7%91%E5%AD%B8%E7%9A%84%E9%A0%98%E5%9F%9F-be9894b3548) ###### [(shengyu7697.github.io)Python numpy 計算平均值 mean/average](https://shengyu7697.github.io/python-numpy-mean/)
×
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