def __str__(self): """Returns human readable string representaition of Marginals""" M = [] for v in list(self['factorials'].values()): M.append(v) M.append(self['dmu']) M.append(self['dN']) M.append(self['dsem']) M.append(self['dlower']) M.append(self['dupper']) M = list(zip(*M)) # transpose # figure out the width needed by the condition labels so we can # set the width of the table flength = sum([ max([len(v) for c in v]) for v in list(self['factorials'].values()) ]) flength += len(self['factorials']) * 2 # build the header header = self.factors + 'Mean;Count;Std.\nError;'\ '95% CI\nlower;95% CI\nupper'.split(';') dtypes = ['t'] * len(self.factors) + ['f', 'i', 'f', 'f', 'f'] aligns = ['l'] * len(self.factors) + ['r', 'l', 'r', 'r', 'r'] # initialize the texttable and add stuff tt = TextTable(max_width=10000000) tt.set_cols_dtype(dtypes) tt.set_cols_align(aligns) tt.add_rows(M, header=False) tt.header(header) tt.set_deco(TextTable.HEADER) # output the table return tt.draw()
def __str__(self): """Returns human readable string representaition of Marginals""" M = [] for v in self['factorials'].values(): M.append(v) M.append(self['dmu']) M.append(self['dN']) M.append(self['dsem']) M.append(self['dlower']) M.append(self['dupper']) M = zip(*M) # transpose # figure out the width needed by the condition labels so we can # set the width of the table flength = sum([max([len(v) for c in v]) for v in self['factorials'].values()]) flength += len(self['factorials']) * 2 # build the header header = self.factors + 'Mean;Count;Std.\nError;'\ '95% CI\nlower;95% CI\nupper'.split(';') dtypes = ['t'] * len(self.factors) + ['f', 'i', 'f', 'f', 'f'] aligns = ['l'] * len(self.factors) + ['r', 'l', 'r', 'r', 'r'] # initialize the texttable and add stuff tt = TextTable(max_width=10000000) tt.set_cols_dtype(dtypes) tt.set_cols_align(aligns) tt.add_rows(M, header=False) tt.header(header) tt.set_deco(TextTable.HEADER) # output the table return tt.draw()