#NEWLINE# def transpose( self ) : #NEWLINE# #INDENT# 'Transpose a :class:`Dataset`, turning rows into columns and vice\n        versa, returning a new ``Dataset`` instance. The first row of the\n        original instance becomes the new header row.' #NEWLINE# if ( not self ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# _dset = Dataset ( ) #NEWLINE# new_headers = ( [ self . headers [ 0 ] ] + row_data [ self . headers [ 0 ] ] ) #NEWLINE# _dset . headers = new_headers #NEWLINE# for column in self . headers : #NEWLINE# #INDENT# if ( column == self . headers [ 0 ] ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# row_data = ( [ column ] + self [ column ] ) #NEWLINE# row_data = Row ( row_data ) #NEWLINE# _dset . append ( row = row_data ) #NEWLINE# #UNINDENT# return _dset