我有一个熊猫数据框,它有一个名为description的长文本列。其中的数据来自jira web实例。我一直在尝试使用几种不同的方法删除文本中的标记,但似乎没有一种方法能够删除\r\n\xa0
这是我到目前为止所拥有的
df['description'] = df['description'].replace(r'http\S+', '', regex=True).replace(r'www\S+', '', regex=True)
df['description'] = df['description'].replace(r'[^\x00-\x7F]+', ' ', regex = True)
df['description'] = df['description'].replace(r'\[(.+)\]\([^\)]+\)', r'\1', regex = True).replace(r'\*\*([^*]+)\*\*', r'\1', regex = True)
df['description'] = df['description'].replace(r'\*([^*]+)\*',r'\1', regex = True )
df['description'] = df['description'].astype(str).str.strip()
你知道我能在这里做什么吗?文本样本
We analyzed found the issue in Garbage Collection which crashed the JVM.\r\n\r\n\xa0\r\n\r\n\xa0\r\n\r\n_Stack: [0x00007f0b58ff1000,0x00007f0b590f1000],\xa0 sp=0x00007f0b590ef120,\xa0 free space=1016k_\r\n\r\n_Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)_\r\n\r\n_V\xa0 [libjvm.so+0x8b9e4f]\xa0 MethodData::clean_extra_data(BoolObjectClosure)+0x1cf_\r\n\r\n_V\xa0 [libjvm.so+0x63c582]\xa0
如果您的字符串不是
raw
,则应该捕获这些内容:否则,请使用以下命令:
相关问题 更多 >
编程相关推荐