='append', index=True)
pandas 设置
#显示所有列
pd.set_option('display.max_columns', None)
#显示所有行
pd.set_option...保存在 mysql 中的数据中有空值,但是使用 pd.str.strip() 处理没有用
使用 replace 替换空格、空值为 nan 也没有用
解决办法:replace 使用正则替换
# 替换\r...\n\t 以及 html 中的\xa0
df.replace(r'\r|\t|\n|\xa0', '', regex=True, inplace=True)
# 替换空格,将空格替换为空字符串
df['...product_name'].replace(r' ', '', regex=True, inplace=True)
# 将空字符串替换为 nan
df['product_name'].replace(...r'', np.nan, regex=True, inplace=True)
# 将乱码替换替换为空字符串(正则为匹配不是中文、字母、数字组成的字符串)
df['product_name'].replace