立即学习:https://edu.csdn.net/course/play/26990/361128?utm_source=blogtoedu
df=pd.read_csv('',encoding='',dtype=str)
df.head(x)--.info()
def f(x):
if '0' in str(x):
return'女'
elif***:
else:
df2['性别']=df['gender'].apply(f)新增一列性别
df2[df2['gender']=='2']
df2.head()
del df2['性别']
df2['性别']=df['gender'].map({'0':'女',})新增一列性别--.map(f)
df2['user_id'].apply(lambda x :
str(x).replace(x[1:3],'**'))第二到三位被隐藏
df2['birth'].apply(lambda x :x[1:5])提取生日2-5位