iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 29
1
AI & Data

大數據與AI研習實作與心得 系列 第 29

Python - pandas (vi) dataframe資料框之相關指令

程式碼:

import pandas as pd
head5=pd.util.testing.makeDataFrame().head(5)  #前5筆
print (head5)
tail5=pd.util.testing.makeDataFrame().tail(10) #後10筆
print (tail5)
head5.to_csv('1.csv')       # 寫成csv檔
#讀取線上 CSV 檔
df = pd.read_csv('http://bit.ly/kaggletrain')  #從網頁讀取csv檔:鐵達尼號乘客資料
df.head()
print (df)

執行結果:
https://ithelp.ithome.com.tw/upload/images/20201014/20112100QpUDekd6M6.png


上一篇
Python - 費式數列之呼吸
下一篇
Python -今天我想來點爬蟲程式
系列文
大數據與AI研習實作與心得 30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言