Bootstrap

搬砖常用代码

记录一些搬砖常用代码

pre-processing

new = df[df.columns[[4, 27, 28, 132,133]]]

取attributes构建新的data frame

new = new.drop(new[new['p_education_sdc']==' '].index)

默认drop行

drop_list = [1,2,3,11,12,13,14, 15,16,17,18,19,20,21,26]
df = df.drop(df.columns[drop_list],axis = 1)

drop列

new.info()

看基本信息

def myoo(x):
    return int(x)

new['p_education_sdc'] = new['p_education_sdc'].apply(myoo)

用函数

df.isnull().sum()

找 missing values

;