Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Going to Python from R, what's the python equivalent of a data frame?

Tags:

python

r

I'm familiar with the R data holders like vectors, dataframe, etc. but need to do some text analysis and it seems like python has some good setups for doing so. My question is where can I find an explanation of how python holds data.

Specifically I have a data set in a tab-separated file where the text is in the 3rd column and the scoring of the data that I need is in the 4th column.

id1            id2            text                             score 123            889     "This is the text I need to read..."      88 234            778     "This is the text I need to read..."      78 345            667     "This is the text I need to read..."      91 

In R I'd just load it into a data frame named df1 and when I wanted to call a column I'd use df1$text or df1[,3] and if I wanted a specific cell I could use df1[1,3].

I am getting a feel for how to read data into python but not how to deal with table like structures.

How would you suggest working with this for a python newbie?

like image 992
screechOwl Avatar asked Mar 08 '12 16:03

screechOwl


1 Answers

Look at the DataFrame object in the pandas library.

like image 95
Joshua Ulrich Avatar answered Oct 17 '22 17:10

Joshua Ulrich