pandas 几个重要知识点

将 NaN 替换成某一数值
使用 fillna 
dataframe.fillna(value = 'xxx',inplace=True)

删除某一个值
使用 drop 
dataframe.drop(10,inplace=True)
交换两行的值

    if m != n:
        temp = np.copy(dataframe[m])
        dataframe[m] = dataframe[n]
        dataframe[n] = temp
    else:
        temp = np.copy(dataframe[dataframe.shape[1]-1])
        dataframe[dataframe.shape[1]-1] = dataframe[n]
        dataframe[n] = temp
删除 columns 这些列

    dataframe.drop(columns = list, inplace=True)

2020-05-29

posted @ 2020-05-29 18:26  CodeYaSuo  阅读(134)  评论(0编辑  收藏  举报