我使用dataframe从excel文件中读取数据。文本变为:
u"\u200bDuring the QA, bla bla bla,\xa0Head of bla bla\xa0for NZ,\xa0was labelled bla bal. With further investigation, bla bla bla bla bla bla."
我试图替换所有这些'u200b'、'\xa0'等,但仍然有一个“\'”无法替换,不知道为什么?你知道吗
def replaceMultiplePattern(row):
for r in ((u'\n', u''), (u'\xa0', u' '), (u'\u2019', "'"), (u'\u2013', '-'), (u'\u200b', ''), (u"\' ", u"'")):
row = row.replace(*r)
return row
另外,在从excel文件读取数据时,是否有任何方法可以避免所有这些unicode转换?你知道吗
谢谢
在python中加载excel后,可以使用unicodedata模块。 您也可以在保存excel文件时使用其编码。你知道吗
您可能需要检查它们引用的documentation
也许在导入文件时添加编码是有效的。你知道吗
相关问题 更多 >
编程相关推荐