2

Okay so I was reading up a text file and using .read_csv() and ended up with this dataframe:

Image DF

But the problem is that, the im feeling rather rotten... text is ended up being as a column rather than a dataframe feature, and when I try to rename the column I just end up losing the feature all together, and skipping onto the 2nd value in the dataframe: enter image description here

EDIT: This is how I read in the text file. enter image description here

Any answers, comments are heartfully accepted.

Mogo
  • 99
  • 11
TrexCodes
  • 87
  • 5

2 Answers2

1

The final solution would be (respectfully concluded by @luigigi)
pd.read_csv("emotions.txt", sep=";", header=None)

Thanks!

Aryan
  • 1,093
  • 9
  • 22
0

You can pre-defined the columns name with the code.

df = pd.read_csv('emotions.txt', sep =';', names=['TEXT','EMOTION'], header=None)
Goh Kok Han
  • 125
  • 1
  • 9