pd.Timestamphtml
pd.to_datetime框架
pd.date_rangedom
pd.index函數
貌似Chrome一直崩潰,搞了老兩杯咖啡的時間都沒法解決。只好放棄治療了,在這篇中繼續未完成的事業,發一篇新的。😓😓😓!貌似最近自我陶醉在寫心得上,雖然來觀看的人寥寥無幾。不過,能讓本身開心的事情,仍是能夠繼續的。code
##pd.Timestamphtm
print(pd.Timestamp('2016-11-23')) stamp=pd.Timestamp('2016-11-23 9:58',tz='US/Eastern') print(stamp)
就如其本名,時間戳。跟時間序列和日期範圍差很少,能夠用來作時區轉化。對象
##pd.to_datetime索引
df = pd.DataFrame({'year': [2015, 2016], 'month': [2, 3], 'day': [4, 5]}) print(pd.to_datetime(df))
將表明時間的字符轉化爲Timestamp對象。get
更多細節參考:參考資料博客
##pd.date_range
day = pd.date_range('2016-11-15','2016-11-20') month = pd.date_range('2016-1-15','2016-11-20',freq='M') month1 = pd.date_range('2016-1-15','2016-11-20',freq=pd.tseries.offsets.DateOffset(months=1)) print(day) print(month) print(month1)
厲害了個人哥,產生一個DatetimeIndex,就是時間序列數據的索引。仔細看month和month1的差異,會用獲得的。
更多細節參考:參考資料
##pd.index
index = pd.date_range('11/1/2016', periods=8) s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e']) df = pd.DataFrame(np.random.randn(8, 3), index=index, columns=['A', 'B', 'C']) print(df.index)
Index:pandas數據操縱的鬼牌(行級索引)
pandas的經常使用函數介紹就應該over了,原本因該中規中矩的介紹一下其餘的。可是若是一直停留在理論上的話,仍是蠻耗費時間的。先抓一些能實際用得着的框架,而後再實際運用中去查漏補缺吧!
最近要CDA的考試,雖然實際運用很重要,然敲門磚一樣不可缺。啃題庫去!
所用代碼片斷:連接: https://pan.baidu.com/s/1c2NyKyW 密碼: gb73
開通了一個博客(www.nigaea.com),歡迎來擾!