Re: pandas dataframe in a reportlab table

Andy Robinson <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CABjtAptCc7=ozRty8Aoe30nCfvTP-0d8dM6VL+ZT0pqdKiEU6Q@mail.gmail.com>
I don't use Pandas, but this seems to do it:
>>> df = [[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]
>>> headings = ['Mean','Max','Min','TestA','TestB']
>>> tbl = [headings] + df
>>> tbl[['Mean', 'Max', 'Min', 'TestA', 'TestB'], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]

Hope this helps,

Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.