Hi guys,
I was working with the pandas package and was so impressed with how simple something was that I had to share. Have you ever worked with csv data (in excel for example) and wanted to import the data to python, take either a column average or row average, then plot it? For example, imagine I have data formatted like:
file1 file2 file3
500 50.0 53.3 43.0
550 23.1 32.0 32.5
600 23.0 23.0 35.0
700 42.0 31.0 44.0
Pandas is a library for handling ordered series data and is GREAT for managing it. It essentially created containers that act as labeled numpy arrays. If I want to read this data in froma file and take the average along the rows (by slicing through names), and output a plot, it is this simple.
from pandas import read_csv
from matplotlib.pyplot import plt
data=read_csv('filename', sep='\t', header=0, index_col=0)
sliceavg=data.ix[550:700].mean(axis=0)
plt.plot(sliceavge)
plt.show()
Pretty impressive if you ask me.
I thought this was such a simple thing to do that I had to share and give some love to this libary. If you work with series data, start using this asap.