EDIT: the correct answer to this is:
df = df.replace(r'
',' ', regex=True)
I think you need replace
:
df = df.replace('
','', regex=True)
Or:
df = df.replace('
',' ', regex=True)
Or:
df = df.replace(r'\n',' ', regex=True)
Sample:
text = '''hands-on
dev nologies
relevant scripting
lang
'''
df = pd.DataFrame({'A':[text]})
print (df)
A
0 hands-on
dev nologies
relevant scripting
la...
df = df.replace('
',' ', regex=True)
print (df)
A
0 hands-on dev nologies relevant scripting lang
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…