Home > Enterprise >  The label tag mixed with comment in sentiment analysis data frame
The label tag mixed with comment in sentiment analysis data frame

Time:11-23

I have below data frame and my label column as u can see is part of sentence row and its separated by \ character. My question is how can I delete these zero and ones or replace them with " " character and transition them to new Label column beside this comment column?

thanks for you're help.

enter image description here

CodePudding user response:

You are loading your dataset wrong.

It is a tab-separated file. You are loading it as a comma-separated file.

Try adding \t as a separator while loading the file. This will create two columns. Also, you can add column names while loading.

Example:

pandas.read_csv(filename, sep='\t', names=['tag', 'text'])
  • Related