import pandas as pd df = pd.read_excel("../datas/duihua.xlsx", sheet_name="Sheet2") df["合并咨询文本"] = df["合并咨询文本"].str.replace("\n", "").str.strip() df["合并咨询文本"] = df["合并咨询文本"].str.replace(r"\s+", " ", regex=True).str.strip() df["合并咨询文本"] = df["合并咨询文本"].str.replace(r"\d+", "", regex=True).str.strip() df.to_excel("../datas/duihua.xlsx", sheet_name="Sheet2", index=False)