执行以下行时:
client_df["NombreCliente2"] = client_df["NombreCliente"]
for var in special_list:
client_df[var] = client_df["NombreCliente"].str.extract(var, expand=False).str.upper()
replace = client_df.loc[~client_df[var].isnull(), var]
client_df.loc[~client_df[var].isnull(),"NombreCliente2"] = replace
client_df.drop(var, axis=1, inplace=True)
我收到以下错误:
Traceback (most recent call last):
File "C:\Users\user\Documents\FYP\python\others.py", line 493, in <module>
client_anaylsis()
File "C:\Users\user\Documents\FYP\python\others.py", line 103, in client_anaylsis
client_df[var] = client_df["NombreCliente"].str.extract(var, expand=False).str.upper()
...
raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \p at position 41