[Pandas-dev] columns names issues using pd.read_csv

John Paul jazzviewer at gmail.com
Mon Aug 6 06:37:06 EDT 2018


Hi list,
I am pretty new to python.
I am trying to  import the SMSSpam Collection Data using pandas read_csv
module.
I
The import went went.
But as the file does not have header I tried to include  columns
names(variables names : "status" and "message" and ended up with empty file.
Here is my code:
<<
import numpy as np
import pandas as pd
file_loc="C:\\Users\\User\Documents\\JP\\SMSCollection.txt"
 df=pd.read_csv(file_loc,sep='\t')
>>
The above code works well I got the  I got the 5571 rows x 2 columns].
But when I add columns using the following line of code
df.columns=["status","message"]
I ended up with an empty df
Any help on this ?
Thanks
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pandas-dev/attachments/20180806/f8d53a05/attachment.html>


More information about the Pandas-dev mailing list