pandas 使用 Python 生成报告:PDF 或 HTML 到 PDF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29414060/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 23:09:14  来源:igfitidea点击:

Generating Reports with Python: PDF or HTML to PDF

pythonpandasmatplotlib

提问by risail

Using maptplotlibI have created 9 graphs which are combined in to a single pdf using the command savefig. However I need to be able to show the statistical analysis below each plot with .describe(). What would be the best way to do this?

使用maptplotlib我创建了 9 个图形,这些图形使用命令组合成一个 pdf savefig。但是,我需要能够使用.describe(). 什么是最好的方法来做到这一点?

采纳答案by Jan Katins

Pandas has the possibility to include a table with a plot. See the tablekwarg to pandas.DataFrame.plot. See the docs: http://pandas.pydata.org/pandas-docs/dev/visualization.html#visualization-table

Pandas 可以包含一个带有情节的表格。查看tablekwarg 到pandas.DataFrame.plot. 请参阅文档:http: //pandas.pydata.org/pandas-docs/dev/visualization.html#visualization-table

回答by Jan Katins

There are multiple possibilities:

有多种可能:

For the last, have a look at https://github.com/JanSchulz/knitpy/tree/master/examples, the docx, pdf and html versions were generated from the .pymdsource. The example includes both pandas.DataFrames and matplotlib figures.

最后,请查看https://github.com/JanSchulz/knitpy/tree/master/examples,docx、pdf 和 html 版本是从.pymd源代码生成的。该示例包括pandas.DataFrames 和 matplotlib 图形。

Disclaimer: I'm the author of knitpy

免责声明:我是 knitpy 的作者