def xb(x):
if pd.isnull(x):
return "空"
elif int(x[-2])%21:
return "男"
elif int(x[-2])%21:
return "男"
elif int(x[-2])%2==0:
return "女"
else:return "其他"
def f(x):
return x.nunique()
def province(x):
if str(x)[0:2] =='11' :
return '北京'
elif str(x)[0:2] =='12' :
return '天津'
elif str(x)[0:2] =='13' :
return '河北'
elif str(x)[0:2] =='14' :
return '山西'
elif str(x)[0:2] =='15' :
return '内蒙古'
elif str(x)[0:2] =='21' :
return '辽宁'
elif str(x)[0:2] =='22' :
return '吉林'
elif str(x)[0:2] =='23' :
return '黑龙江'
elif str(x)[0:2] =='31' :
return '上海'
elif str(x)[0:2] =='32' :
return '江苏'
elif str(x)[0:2] =='33' :
return '浙江'
elif str(x)[0:2] =='34' :
return '安徽'
elif str(x)[0:2] =='35' :
return '福建'
elif str(x)[0:2] =='36' :
return '江西'
elif str(x)[0:2] =='37' :
return '山东'
elif str(x)[0:2] =='41' :
return '河南'
elif str(x)[0:2] =='42' :
return '湖北'
elif str(x)[0:2] =='43' :
return '湖南'
elif str(x)[0:2] =='44' :
return '广东'
elif str(x)[0:2] =='45' :
return '广西'
elif str(x)[0:2] =='46' :
return '海南'
elif str(x)[0:2] =='50' :
return '重庆'
elif str(x)[0:2] =='51' :
return '四川'
elif str(x)[0:2] =='52' :
return '贵州'
elif str(x)[0:2] =='53' :
return '云南'
elif str(x)[0:2] =='54' :
return '西藏'
elif str(x)[0:2] =='61' :
return '陕西'
elif str(x)[0:2] =='62' :
return '甘肃'
elif str(x)[0:2] =='63' :
return '青海'
elif str(x)[0:2] =='64' :
return '宁夏'
else : return '新疆'
def mount(x):
if pd.isnull(x):
return '其他'
elif x '[1-1000)':
return 1000
elif x'[1000-5000)':
return 5000
else : return x