added a few lines from the pandas book which will hopefully help pivot the data