1六、DataFrame.sort_values( columns , inplace = True , ascending = False)app
以columns的value爲基礎對DataFrame排序;函數
若inplace爲True,則用排序後的結果替換原來的數值,若爲False,則僅僅返回排序後的結果,不對原 DataFrame 產生影響;排序
ascending 默認爲 True ,升序排列,能夠指定爲 False ,降序排列。索引
1七、 pandas.isnull(DataFrame)pandas
返回一個 DataFrame ,原 DataFrame中爲 null 值的位置的值爲 True ,不爲 null 值的位置的值爲 False 。table
1八、 DataFrame.fillna( value , inplace = False )class
返回一個 DataFrame , 用 value 值替換原 DataFrame 中的 nan 值;基礎
inplace 爲 True 時替換原 DataFrame 的值,爲 False 時僅僅返回排序後的結果,不對原 DataFrame 產生影響。搜索
1九、當 DataFrame 中有 nan 值時,對其所做計算獲得的都會是 nan 值。方法
20、當 DataFrame 中有 nan 值時,兩種方法對數據作處理:
1)經過 pandas.isnull() 函數獲得反應 nan 值位置的 DataFrame ,將其中爲 True 的值做爲索引傳入原 DataFrame 獲得全部不爲 null 值的數據;
2)經過 DataFrame.fillna() 函數將 nan 值替換爲中值或平均值(平均值還不是得算,中值還不是得找,應該是用在其餘列的數據頗有用的狀況下)
寫到這,看起來,這兩種方法大概會結合起來使用。
2一、 DataFrame[columns].mean() 求 columns 列的均值,自帶去 nan 的功能。
2二、 DataFrame.pivot_table( index = column1 , values = column2 , aggfunc = np.mean ) 數據透視表
index 告訴函數 group by 哪一個列
values 告訴函數咱們想要計算哪一列
aggfuc 告訴函數咱們想要作什麼計算(默認爲 mean() )。
2三、 DataFrame.dropna( axis = 1 ,subset = [ column1 , column2 ])
axis 爲 1 時,將有 nan 值的列刪除,
axis 爲 0 時,將有 nan 值的行刪除, subset 設置搜索範圍。
2四、 DataFrame.loc[ RowNumber , ColumnName ]
返回指定列指定行的值。
2五、 DataFrame.reset_index( drop = True)
在排序後用來重建索引, drop 與 inplace 相似。
2六、DataFrame.loc[ 0 : 10 ] 與 DataFrame[ 0 : 10 ] 等價
2七、 DataFrame.apply( MethonName , axis = 0 )
將 DataFrame 的每一列( axis = 0 時)或者每一行( axis = 1 時)傳入函數中,獲得計算結果, axis 默認爲 0 ;
能夠這樣理解,當 axis = 0 時,是對一列中的每行的值作操做,當 axis = 1 時,是對一行中的每列的值作操做,因此仍是 axis = 0 對應行, axis =1 對應列。
2八、DataFrame 由 Series 構成,每一行每一列都是一個 Series ,Series.value 爲 ndarray 格式,也就是說列名做爲 key , ndarray 做爲 value 構成了一個 Series。
2九、 Series 的索引性質與 DataFrame 一致。