用官網中的數據舉例:df 爲下面的dataframehtml
A B C D 2013-01-01 0.469112 -0.282863 -1.509059 -1.135632 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 2013-01-03 -0.861849 -2.104569 -0.494929 1.071804 2013-01-04 0.721555 -0.706771 -1.039575 0.271860 2013-01-05 -0.424972 0.567020 0.276232 -1.087401 2013-01-06 -0.673690 0.113648 -1.478427 0.524988
loc爲 Selection by Label函數,簡單的來說,即爲按標籤取數據,標籤是什麼,就是上面的'2013-01-01' ~'2013-01-06', 'A'~'D'函數
下面舉幾個例子,第一個參數選擇index,第二個參數選擇columnspa
iloc函數爲Selection by Position,即按位置選擇數據,即第n行,第n列數據,因此傳入的是位置的整數型參數。htm
下面舉幾個列子:pandas
ref: http://pandas.pydata.org/pandas-docs/stable/10min.htmlit