Solution
If the question has been read out, then the only replace
alternative is to use:
import pandas as pd
def change_excel_char(value):
"""剔除读取excel中的 _x0000_ 字符"""
if type(value) == str:
return value.replace("_x0000_", '')
else:
return value
excel_data = pd.read_excel("xxxx.xlsx")
excel_data = excel_data.applymap(change_excel_char)
problem analysis
This is because when pandas parses excel .xlsx
files, the engine used is openpyxl, and in some cases, due to the modification of excel files, some encoding formats are left in the excel cells, which will cause accidents when using openpyxl