无法分离 csv 中的文本数据。 (用@分隔文本,使其成为两列)
Unable to separate text data in csv. (Separate text with @ so that it becomes two columns)
据 Gran 称,该公司没有将所有生产转移到俄罗斯的计划,尽管这是公司发展的地方。@neutral
上面是正文,我想用@分隔它,这样它会产生两列
data = pd.read_csv(r'F:\Sentences_50Agree.csv', sep='@', header=None)
我试过上面的方法,但没有用。它仅显示 1 列,其中包含@neutral
的全部文本
import pandas as pd
from io import StringIO
s = 'According to Gran, the company has no plans to move all production to Russia, although that is where the company is growing .@neutral'
print( pd.read_csv(StringIO(s), sep='@', header=None) )
打印:
0 1
0 According to Gran, the company has no plans to... neutral
或文件:
print( pd.read_csv('file.txt', sep='@', header=None) )
据 Gran 称,该公司没有将所有生产转移到俄罗斯的计划,尽管这是公司发展的地方。@neutral
上面是正文,我想用@分隔它,这样它会产生两列
data = pd.read_csv(r'F:\Sentences_50Agree.csv', sep='@', header=None)
我试过上面的方法,但没有用。它仅显示 1 列,其中包含@neutral
的全部文本import pandas as pd
from io import StringIO
s = 'According to Gran, the company has no plans to move all production to Russia, although that is where the company is growing .@neutral'
print( pd.read_csv(StringIO(s), sep='@', header=None) )
打印:
0 1
0 According to Gran, the company has no plans to... neutral
或文件:
print( pd.read_csv('file.txt', sep='@', header=None) )