Pandas: or why I need to stop rolling my own tabular data parsers in Python.

I don’t know how many times I’ve written the following Python code:

f = [x.split('\t') for x in open('tab_delimited_data.out').read()]

to read tab delimited data. With Pandas, the python data manipulation library, it’s as easy as R:

f = pd.read_csv('tab_data.out', sep='\t', index_col=0)

and now I have a data frame, with a billion more useful functions than my 2D list I usually would have.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s