用官網(wǎng)中的數(shù)據(jù)舉例:df 為下面的dataframe
A B C D2013-01-01 0.469112 -0.282863 -1.509059 -1.1356322013-01-02 1.212112 -0.173215 0.119209 -1.0442362013-01-03 -0.861849 -2.104569 -0.494929 1.0718042013-01-04 0.721555 -0.706771 -1.039575 0.2718602013-01-05 -0.424972 0.567020 0.276232 -1.0874012013-01-06 -0.673690 0.113648 -1.478427 0.524988
loc為 Selection by Label函數(shù),簡單的來講,即為按標(biāo)簽取數(shù)據(jù),標(biāo)簽是什么,就是上面的'2013-01-01' ~'2013-01-06', 'A'~'D'
下面舉幾個例子,第一個參數(shù)選擇index,第二個參數(shù)選擇column
iloc函數(shù)為Selection by Position,即按位置選擇數(shù)據(jù),即第n行,第n列數(shù)據(jù),所以傳入的是位置的整數(shù)型參數(shù)。
下面舉幾個列子:
ref: http://pandas.pydata.org/pandas-docs/stable/10min.html