用官網(wǎng)中的數(shù)據(jù)舉例:df 為下面的dataframe 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 1. loc函數(shù)loc為 Selection by Label函數(shù),,簡單的來講,,即為按標簽取數(shù)據(jù),標簽是什么,,就是上面的'2013-01-01' ~'2013-01-06', 'A'~'D' 下面舉幾個例子,,第一個參數(shù)選擇index,第二個參數(shù)選擇column 2. iloc函數(shù)iloc函數(shù)為Selection by Position,,即按位置選擇數(shù)據(jù),即第n行,,第n列數(shù)據(jù),,所以傳入的是位置的整數(shù)型參數(shù)。 下面舉幾個列子: ref: http://pandas./pandas-docs/stable/10min.html |
|