先上结果:

定义转换函数代码:

def range2min(text):
    if '千' in text:
        text=text.replace('千','000')#替换中文为数字
    if '万' in text:
        if '.' in text:
            text=text.replace('.','')
            text=text.replace('万','000')
        else:
            text=text.replace('万','0000')
    if '元' in text:
        text=text.replace('元','')
    if '/月' in text:#把月转换
        text=text.replace('/月','')
    if '/天' in text:#把天转换
        text=int(text.split('-')[0])*21.75#日薪转换为月薪
    else:
        text=text.split('-')[0]
    return str(text)#提取-特定字符之前的数字
def range2max(text):
    if '千' in text:
        text=text.replace('千','000')    
    if '元' in text:
        text=text.replace('元','')
    if '/月' in text:#把月转换
        text=text.replace('/月','')    
    if len(text.split('-'))>1:#判断确实是区间、
        if '万' in text:
            if '.' in text.split('-')[1]:
                text=text.replace('.','')
                text=text.replace('万','000')
            else:
                text=text.replace('万','0000')
        if '/天' in text:
            text=text.replace('/天','')
            text=int(text.split('-')[1])*21.75
        else:
            text=text.split('-')[1]
        return str(text)#提取-特定字符之后的数字
    else:
        return text.split('-')[0]

然后应用函数到pandas

data['salary_min']=data['salary'].astype(str).apply(range2min)#对列应用自定义函数
data['salary_max']=data['salary'].astype(str).apply(range2max)
data

原本dataframe:

得到dataframe: