考虑是某些字符无法解码为utf-8的编码格式,把dataframe(meta)的元素,在编码过程中,先把无法转化为utf-8格式的字符‘ignore’掉,再进行解码。
for i in meta:
for j in meta.index:
meta.loc[j,i] = meta.loc[j,i].encode('UTF-8','ignore').decode('UTF-8')
最后再将DataFrame写入csv或者excel
meta.to_csv('metaData_+C_0.csv')