I am trying to create a DataFrame object for my spam classifier.It's supposed to contain two columns: 'messages' and 'class'. However when I use the dataframe.append
function to add emails as 'messages' to my dataframe along with the folder name as 'class', I'm getting this error:
AttributeError: 'DataFrame' object has no attribute 'append'
For this I initially created a Dataframe as follow
data = DataFrame({'message': [], 'class': []})
I tried to use the DataFrame.append() function for adding the spam and ham emails to the DataFrame. Here's the code I am using:
data = DataFrame({'message': [], 'class': []})
data = data.append(dataFrameFromDirectory('D:\email_classifier\spam', 'spam'))
data = data.append(dataFrameFromDirectory('D:\email_classifier\ham', 'ham'))
In theory, this should add the emails and the folder name to data. Is there a way to get around this without having to use an older version of pandas?