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.

Leave a Reply

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

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

Facebook photo

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

Connecting to %s