Update table.

This commit is contained in:
Mikaël Capelle 2017-07-20 11:15:48 +02:00
parent 8aa3d06b19
commit 82418bd6c3

View File

@ -62,16 +62,14 @@ class tabledf(table):
super().__init__(**kargs)
if header is None:
multilevels, header = self.create_header(df)
df = df.reset_index()
if multilevels:
ncols = len(header[-1])
df = df.reset_index()
else:
ncols = len(header)
header = [header]
tab = tabular(columns='r' * ncols)
if multilevels:
tab.addrows(header)
else:
tab.addrow(header)
tab.addrows(header)
tab.addhline()
tab.addrows(df.astype(object).values, fmt=fmt)
self.add(tab)