目錄
1.pandas預處理的常用操作
鏈接的文章已經講解的相對比較清楚了,包括:
(1)缺失值處理:dropna(),fillna()
(2)離散化:cut(),qcut()
(3)分組聚合:groupby()
(4)數據透視表:pivot_table()
(5)排序:sort_values()
https://blog.csdn.net/OYY_90/article/details/89114342?from=singlemessage&isappinstallend=0
2.個人補充內容
reindex
(index, method, fill_value, limit, level, copy, columns):重新索引函數(行索引)
index: 用作索引的新序列。(索引存在則保留,不存在則按照順序創建,並以fill_value的值填充)
method: 插值的方式(pad/ffill:向前填充(原排列的最後一行); bfill/backfill: 向後填充(原排列的第一行))
columns: 列索引
limit: 限制插值的行數(要求index必須是升序排列)
dropna
(how, axis, thresh, subset): 刪除缺失值
subset: 參數subset移出指定列爲空的所有行數據
duplicated
(columns, keep):標識重複行
drop_duplicateds
(columns, keep): 刪除重複行
columns: 列名
keep: 標識/刪除的方式(keep=First: 標記/刪除除第一行外的其他行; keep=last: 標記/刪除除最後一行外的其他行; keep=False: 標記/刪除所有行)