我有一个带有两列的电影评论数据帧:电影名称和评论。我想根据定界符将评论分为句子。或短语。然后,我想进行拆分查看,并将其下移一列,同时也将电影的名称下移一列。关键是要使基于每个句子或短语的情绪分析更加容易。
df[review] = df['review'].str.split('. or ? or ! or ?').reshape(0,1)
movie1.........Great movie...................................................................................................
movie1.........and Alot of action............................................ movie2.........What did I think?..........................................................................................
movie2..........It was a horrible...........................................................................................
movie2..........and waste of money!!..............................
答案 0 :(得分:0)
df.Review.str.split('。')。apply(Series,1).stack()