def toxls(self,wrownames=False):
        """To xls file format (tab-delimited)"""
        
        ncols=len(self.colnames)
        nrows=len(self.rownames)
        
        # if table is not NULL
        if self.table:
            header='#'+'\t'.join(self.colnames)+'\n'
            rows=''
            for i in xrange(nrows):
                if wrownames:
                    rows+=self.rownames[i]+'\t'+'\t'.join([str(self.table[colname][i]) for colname in self.colnames])+'\n'
                else:
                    rows+='\t'.join([str(self.table[colname][i]) for colname in self.colnames])+'\n'
            return header+rows
        else:
            return 'NULL data frame with %d rows and %d columns' %(nrows,ncols)
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/DataFrame.toxls/original