{"id":985424,"date":"2024-12-27T07:36:32","date_gmt":"2024-12-26T23:36:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/985424.html"},"modified":"2024-12-27T07:36:34","modified_gmt":"2024-12-26T23:36:34","slug":"python%e5%a6%82%e4%bd%95%e5%86%99%e6%8a%a5%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/985424.html","title":{"rendered":"python\u5982\u4f55\u5199\u62a5\u8868"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24212601\/b70089de-d5af-47c3-b783-91c846cb495f.webp\" alt=\"python\u5982\u4f55\u5199\u62a5\u8868\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u5199\u62a5\u8868\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u591a\u4e2a\u5e93\u548c\u5de5\u5177\u6765\u5b9e\u73b0\uff0c\u5982pandas\u3001matplotlib\u3001seaborn\u3001reportlab\u7b49\u3002\u4f7f\u7528pandas\u8fdb\u884c\u6570\u636e\u5904\u7406\u3001matplotlib\u548cseaborn\u7ed8\u5236\u56fe\u8868\u3001reportlab\u751f\u6210PDF\u62a5\u8868\u3002\u8fd9\u4e9b\u5de5\u5177\u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u521b\u5efa\u4e13\u4e1a\u7684\u62a5\u8868\uff0c\u6ee1\u8db3\u4e0d\u540c\u7684\u9700\u6c42\u3002<\/strong>\u5176\u4e2d\uff0cpandas\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u80fd\u529b\uff0c\u53ef\u4ee5\u5bf9\u6570\u636e\u8fdb\u884c\u6e05\u6d17\u548c\u8f6c\u6362\uff1bmatplotlib\u548cseaborn\u7528\u4e8e\u521b\u5efa\u5404\u79cd\u7c7b\u578b\u7684\u56fe\u8868\uff0c\u4f7f\u62a5\u8868\u66f4\u5177\u89c6\u89c9\u5438\u5f15\u529b\uff1breportlab\u5219\u53ef\u4ee5\u751f\u6210PDF\u683c\u5f0f\u7684\u62a5\u8868\uff0c\u4fbf\u4e8e\u5206\u4eab\u548c\u6253\u5370\u3002\u63a5\u4e0b\u6765\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u6765\u751f\u6210\u62a5\u8868\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001PANDAS\u7528\u4e8e\u6570\u636e\u5904\u7406<\/p>\n<\/p>\n<p><p>pandas\u662fPython\u4e2d\u6700\u5e38\u7528\u7684\u6570\u636e\u5206\u6790\u5e93\u4e4b\u4e00\uff0c\u5b83\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\u529f\u80fd\u3002\u4f7f\u7528pandas\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5bf9\u6570\u636e\u8fdb\u884c\u6e05\u6d17\u3001\u8f6c\u6362\u548c\u805a\u5408\uff0c\u8fd9\u4e9b\u6b65\u9aa4\u901a\u5e38\u662f\u751f\u6210\u62a5\u8868\u7684\u7b2c\u4e00\u6b65\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u636e\u5bfc\u5165\u548c\u6e05\u6d17<\/strong><\/p>\n<\/p>\n<p><p>pandas\u652f\u6301\u4ece\u591a\u79cd\u6570\u636e\u6e90\u5bfc\u5165\u6570\u636e\uff0c\u5305\u62ecCSV\u3001Excel\u3001SQL\u6570\u636e\u5e93\u7b49\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>read_csv<\/code>\u3001<code>read_excel<\/code>\u7b49\u51fd\u6570\u6765\u8bfb\u53d6\u6570\u636e\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<code>head()<\/code>\u65b9\u6cd5\u67e5\u770b\u6570\u636e\u7684\u524d\u51e0\u884c\uff0c\u4ece\u800c\u4e86\u89e3\u6570\u636e\u7684\u7ed3\u6784\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u5bfc\u5165\u6570\u636e<\/strong><\/h2>\n<p>df = pd.read_csv(&#39;data.csv&#39;)<\/p>\n<h2><strong>\u67e5\u770b\u6570\u636e\u7ed3\u6784<\/strong><\/h2>\n<p>print(df.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u5bfc\u5165\u6570\u636e\u540e\uff0c\u901a\u5e38\u9700\u8981\u5bf9\u6570\u636e\u8fdb\u884c\u6e05\u6d17\uff0c\u6bd4\u5982\u5904\u7406\u7f3a\u5931\u503c\u3001\u53bb\u9664\u91cd\u590d\u6570\u636e\u7b49\u3002pandas\u63d0\u4f9b\u4e86\u8bf8\u5982<code>dropna()<\/code>\u3001<code>fillna()<\/code>\u3001<code>drop_duplicates()<\/code>\u7b49\u65b9\u6cd5\u6765\u5e2e\u52a9\u5b8c\u6210\u8fd9\u4e9b\u4efb\u52a1\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u8f6c\u6362\u548c\u805a\u5408<\/strong><\/p>\n<\/p>\n<p><p>\u6570\u636e\u6e05\u6d17\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pandas\u8fdb\u884c\u6570\u636e\u8f6c\u6362\u548c\u805a\u5408\u64cd\u4f5c\u3002<code>groupby()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u6839\u636e\u67d0\u4e9b\u5217\u5bf9\u6570\u636e\u8fdb\u884c\u5206\u7ec4\uff0c\u5e76\u7ed3\u5408<code>agg()<\/code>\u65b9\u6cd5\u5bf9\u5206\u7ec4\u6570\u636e\u8fdb\u884c\u7edf\u8ba1\u6c47\u603b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6309\u67d0\u5217\u5206\u7ec4\u5e76\u805a\u5408<\/p>\n<p>grouped = df.groupby(&#39;category&#39;).agg({&#39;sales&#39;: &#39;sum&#39;, &#39;profit&#39;: &#39;mean&#39;})<\/p>\n<p>print(grouped)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001MATPLOTLIB\u548cSEABORN\u7528\u4e8e\u6570\u636e\u53ef\u89c6\u5316<\/p>\n<\/p>\n<p><p>\u6570\u636e\u53ef\u89c6\u5316\u662f\u751f\u6210\u62a5\u8868\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u5b83\u53ef\u4ee5\u5e2e\u52a9\u66f4\u76f4\u89c2\u5730\u5c55\u793a\u6570\u636e\u8d8b\u52bf\u548c\u7279\u5f81\u3002matplotlib\u548cseaborn\u662fPython\u4e2d\u4e24\u4e2a\u5f3a\u5927\u7684\u6570\u636e\u53ef\u89c6\u5316\u5e93\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528MATPLOTLIB\u7ed8\u5236\u57fa\u672c\u56fe\u8868<\/strong><\/p>\n<\/p>\n<p><p>matplotlib\u662f\u4e00\u4e2a\u57fa\u7840\u7684\u7ed8\u56fe\u5e93\uff0c\u51e0\u4e4e\u53ef\u4ee5\u7ed8\u5236\u6240\u6709\u7c7b\u578b\u7684\u56fe\u8868\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u7ed8\u5236\u6298\u7ebf\u56fe\u3001\u67f1\u72b6\u56fe\u3001\u6563\u70b9\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<h2><strong>\u7ed8\u5236\u6298\u7ebf\u56fe<\/strong><\/h2>\n<p>plt.plot(df[&#39;date&#39;], df[&#39;sales&#39;])<\/p>\n<p>plt.title(&#39;Sales Over Time&#39;)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Sales&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528SEABORN\u521b\u5efa\u9ad8\u7ea7\u56fe\u8868<\/strong><\/p>\n<\/p>\n<p><p>seaborn\u662f\u5728matplotlib\u57fa\u7840\u4e0a\u6784\u5efa\u7684\u9ad8\u7ea7\u53ef\u89c6\u5316\u5e93\uff0c\u63d0\u4f9b\u4e86\u66f4\u7b80\u6d01\u7684\u63a5\u53e3\u548c\u66f4\u7f8e\u89c2\u7684\u9ed8\u8ba4\u6837\u5f0f\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528seaborn\u5feb\u901f\u521b\u5efa\u70ed\u529b\u56fe\u3001\u76d2\u56fe\u3001\u5206\u5e03\u56fe\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import seaborn as sns<\/p>\n<h2><strong>\u7ed8\u5236\u70ed\u529b\u56fe<\/strong><\/h2>\n<p>sns.heatmap(grouped, annot=True)<\/p>\n<p>plt.title(&#39;Category Sales and Profit&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001REPORTLAB\u7528\u4e8e\u751f\u6210PDF\u62a5\u8868<\/p>\n<\/p>\n<p><p>\u751f\u6210PDF\u62a5\u8868\u662f\u8bb8\u591a\u4f01\u4e1a\u9700\u6c42\u7684\u91cd\u8981\u4e00\u73af\uff0creportlab\u662f\u4e00\u4e2a\u5f3a\u5927\u7684Python\u5e93\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u590d\u6742\u7684PDF\u6587\u6863\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u7b80\u5355PDF\u6587\u6863<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528reportlab\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684PDF\u6587\u6863\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u6587\u672c\u3001\u56fe\u7247\u548c\u7b80\u5355\u7684\u56fe\u5f62\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from reportlab.lib.pagesizes import letter<\/p>\n<p>from reportlab.pdfgen import canvas<\/p>\n<h2><strong>\u521b\u5efaPDF\u6587\u4ef6<\/strong><\/h2>\n<p>c = canvas.Canvas(&quot;report.pdf&quot;, pagesize=letter)<\/p>\n<h2><strong>\u6dfb\u52a0\u6587\u672c<\/strong><\/h2>\n<p>c.drawString(100, 750, &quot;Sales Report&quot;)<\/p>\n<h2><strong>\u4fdd\u5b58PDF<\/strong><\/h2>\n<p>c.save()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0\u590d\u6742\u5185\u5bb9<\/strong><\/p>\n<\/p>\n<p><p>reportlab\u8fd8\u652f\u6301\u66f4\u590d\u6742\u7684PDF\u7ed3\u6784\uff0c\u6bd4\u5982\u8868\u683c\u3001\u56fe\u8868\u7b49\u3002\u4f60\u53ef\u4ee5\u7ed3\u5408pandas\u7684\u6570\u636e\u5904\u7406\u7ed3\u679c\u548cmatplotlib\/seaborn\u7684\u56fe\u8868\u6765\u4e30\u5bccPDF\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from reportlab.platypus import SimpleDocTemplate, Table, TableStyle<\/p>\n<p>from reportlab.lib import colors<\/p>\n<h2><strong>\u521b\u5efaPDF\u6587\u6863<\/strong><\/h2>\n<p>doc = SimpleDocTemplate(&quot;complex_report.pdf&quot;, pagesize=letter)<\/p>\n<h2><strong>\u521b\u5efa\u8868\u683c\u6570\u636e<\/strong><\/h2>\n<p>data = [[&quot;Category&quot;, &quot;Sales&quot;, &quot;Profit&quot;]] + grouped.reset_index().values.tolist()<\/p>\n<h2><strong>\u521b\u5efa\u8868\u683c<\/strong><\/h2>\n<p>table = Table(data)<\/p>\n<p>table.setStyle(TableStyle([(&#39;BACKGROUND&#39;, (0, 0), (-1, 0), colors.grey),<\/p>\n<p>                           (&#39;TEXTCOLOR&#39;, (0, 0), (-1, 0), colors.whitesmoke),<\/p>\n<p>                           (&#39;ALIGN&#39;, (0, 0), (-1, -1), &#39;CENTER&#39;),<\/p>\n<p>                           (&#39;FONTNAME&#39;, (0, 0), (-1, 0), &#39;Helvetica-Bold&#39;),<\/p>\n<p>                           (&#39;BOTTOMPADDING&#39;, (0, 0), (-1, 0), 12),<\/p>\n<p>                           (&#39;BACKGROUND&#39;, (0, 1), (-1, -1), colors.beige),<\/p>\n<p>                           (&#39;GRID&#39;, (0, 0), (-1, -1), 1, colors.black)]))<\/p>\n<h2><strong>\u6dfb\u52a0\u5143\u7d20\u5230PDF<\/strong><\/h2>\n<p>elements = [table]<\/p>\n<p>doc.build(elements)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u7efc\u5408\u793a\u4f8b\uff1a\u521b\u5efa\u5b8c\u6574\u62a5\u8868<\/p>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7efc\u5408\u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u7ed3\u5408\u4f7f\u7528pandas\u3001matplotlib\u3001seaborn\u548creportlab\u521b\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u62a5\u8868\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6570\u636e\u5904\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f7f\u7528pandas\u8fdb\u884c\u6570\u636e\u7684\u5bfc\u5165\u3001\u6e05\u6d17\u548c\u805a\u5408\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df = pd.read_csv(&#39;data.csv&#39;)<\/p>\n<p>df.fillna(0, inplace=True)<\/p>\n<p>grouped = df.groupby(&#39;category&#39;).agg({&#39;sales&#39;: &#39;sum&#39;, &#39;profit&#39;: &#39;mean&#39;}).reset_index()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u53ef\u89c6\u5316<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528matplotlib\u548cseaborn\u7ed8\u5236\u56fe\u8868\uff0c\u4fdd\u5b58\u4e3a\u56fe\u7247\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">plt.figure(figsize=(10, 6))<\/p>\n<p>plt.bar(grouped[&#39;category&#39;], grouped[&#39;sales&#39;])<\/p>\n<p>plt.title(&#39;Total Sales by Category&#39;)<\/p>\n<p>plt.xlabel(&#39;Category&#39;)<\/p>\n<p>plt.ylabel(&#39;Sales&#39;)<\/p>\n<p>plt.savefig(&#39;sales_chart.png&#39;)<\/p>\n<p>plt.close()<\/p>\n<p>sns.heatmap(grouped[[&#39;sales&#39;, &#39;profit&#39;]].set_index(grouped[&#39;category&#39;]), annot=True)<\/p>\n<p>plt.title(&#39;Sales and Profit Heatmap&#39;)<\/p>\n<p>plt.savefig(&#39;heatmap.png&#39;)<\/p>\n<p>plt.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u751f\u6210PDF\u62a5\u8868<\/strong><\/p>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u4f7f\u7528reportlab\u751f\u6210PDF\u62a5\u8868\uff0c\u5e76\u5c06\u4e4b\u524d\u751f\u6210\u7684\u56fe\u8868\u6dfb\u52a0\u5230PDF\u4e2d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from reportlab.platypus import Image<\/p>\n<p>doc = SimpleDocTemplate(&quot;final_report.pdf&quot;, pagesize=letter)<\/p>\n<h2><strong>\u521b\u5efa\u8868\u683c\u6570\u636e<\/strong><\/h2>\n<p>data = [[&quot;Category&quot;, &quot;Sales&quot;, &quot;Profit&quot;]] + grouped.values.tolist()<\/p>\n<p>table = Table(data)<\/p>\n<p>table.setStyle(TableStyle([(&#39;BACKGROUND&#39;, (0, 0), (-1, 0), colors.grey),<\/p>\n<p>                           (&#39;TEXTCOLOR&#39;, (0, 0), (-1, 0), colors.whitesmoke),<\/p>\n<p>                           (&#39;ALIGN&#39;, (0, 0), (-1, -1), &#39;CENTER&#39;),<\/p>\n<p>                           (&#39;FONTNAME&#39;, (0, 0), (-1, 0), &#39;Helvetica-Bold&#39;),<\/p>\n<p>                           (&#39;BOTTOMPADDING&#39;, (0, 0), (-1, 0), 12),<\/p>\n<p>                           (&#39;BACKGROUND&#39;, (0, 1), (-1, -1), colors.beige),<\/p>\n<p>                           (&#39;GRID&#39;, (0, 0), (-1, -1), 1, colors.black)]))<\/p>\n<h2><strong>\u6dfb\u52a0\u56fe\u8868<\/strong><\/h2>\n<p>sales_chart = Image(&#39;sales_chart.png&#39;)<\/p>\n<p>heatmap = Image(&#39;heatmap.png&#39;)<\/p>\n<h2><strong>\u6dfb\u52a0\u5143\u7d20\u5230PDF<\/strong><\/h2>\n<p>elements = [table, sales_chart, heatmap]<\/p>\n<p>doc.build(elements)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6570\u636e\u8868\u683c\u548c\u56fe\u8868\u7684\u5b8c\u6574PDF\u62a5\u8868\u3002\u8fd9\u6837\u7684\u62a5\u8868\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u6570\u636e\u5206\u6790\u548c\u5c55\u793a\uff0c\u8fd8\u53ef\u4ee5\u7528\u4e8e\u4f01\u4e1a\u5185\u90e8\u6216\u5916\u90e8\u7684\u62a5\u544a\u548c\u51b3\u7b56\u652f\u6301\u3002\u719f\u7ec3\u638c\u63e1\u8fd9\u4e9b\u5de5\u5177\uff0c\u5c06\u4f7f\u4f60\u5728\u6570\u636e\u5904\u7406\u548c\u62a5\u8868\u751f\u6210\u65b9\u9762\u6e38\u5203\u6709\u4f59\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u751f\u6210\u62a5\u8868\uff1f<\/strong><br \/>Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5e93\u6765\u751f\u6210\u62a5\u8868\uff0c\u5305\u62ecPandas\u3001Matplotlib\u548cReportLab\u7b49\u3002Pandas\u53ef\u4ee5\u7528\u6765\u5904\u7406\u6570\u636e\u5e76\u751f\u6210Excel\u62a5\u8868\uff0cMatplotlib\u53ef\u4ee5\u521b\u5efa\u56fe\u8868\u8fdb\u884c\u6570\u636e\u53ef\u89c6\u5316\uff0c\u800cReportLab\u5219\u9002\u5408\u751f\u6210PDF\u683c\u5f0f\u7684\u62a5\u8868\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5e93\uff0c\u5e76\u5229\u7528\u8fd9\u4e9b\u5e93\u7684\u5f3a\u5927\u529f\u80fd\u6765\u751f\u6210\u9ad8\u8d28\u91cf\u7684\u62a5\u8868\u3002<\/p>\n<p><strong>Python\u751f\u6210\u62a5\u8868\u65f6\u5982\u4f55\u5904\u7406\u6570\u636e\uff1f<\/strong><br \/>\u5728\u751f\u6210\u62a5\u8868\u4e4b\u524d\uff0c\u6570\u636e\u7684\u5904\u7406\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u4f7f\u7528Pandas\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u8bfb\u53d6CSV\u3001Excel\u7b49\u683c\u5f0f\u7684\u6570\u636e\uff0c\u5e76\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u3001\u7b5b\u9009\u548c\u6c47\u603b\u3002\u901a\u8fc7\u4f7f\u7528DataFrame\u5bf9\u8c61\uff0c\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u6570\u636e\u64cd\u4f5c\uff0c\u751f\u6210\u6240\u9700\u7684\u683c\u5f0f\u548c\u5185\u5bb9\uff0c\u4ee5\u786e\u4fdd\u62a5\u8868\u7684\u51c6\u786e\u6027\u548c\u53ef\u8bfb\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06Python\u751f\u6210\u7684\u62a5\u8868\u5bfc\u51fa\u4e3a\u4e0d\u540c\u683c\u5f0f\uff1f<\/strong><br \/>Python\u652f\u6301\u5c06\u62a5\u8868\u5bfc\u51fa\u4e3a\u591a\u79cd\u683c\u5f0f\uff0c\u5982CSV\u3001Excel\u3001PDF\u548cHTML\u7b49\u3002\u5229\u7528Pandas\u5e93\u4e2d\u7684<code>to_csv<\/code>\u548c<code>to_excel<\/code>\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5c06\u6570\u636e\u5bfc\u51fa\u4e3aCSV\u548cExcel\u6587\u4ef6\u3002\u800c\u4f7f\u7528ReportLab\u5e93\uff0c\u7528\u6237\u53ef\u4ee5\u521b\u5efaPDF\u6587\u4ef6\u3002\u5bf9\u4e8eWeb\u5e94\u7528\uff0c\u53ef\u4ee5\u4f7f\u7528Flask\u6216Django\u7b49\u6846\u67b6\uff0c\u5c06\u62a5\u8868\u52a8\u6001\u751f\u6210\u5e76\u5bfc\u51fa\u4e3aHTML\u683c\u5f0f\uff0c\u4ee5\u4fbf\u4e8e\u5728\u7ebf\u67e5\u770b\u548c\u4e0b\u8f7d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5199\u62a5\u8868\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u591a\u4e2a\u5e93\u548c\u5de5\u5177\u6765\u5b9e\u73b0\uff0c\u5982pandas\u3001matplotlib\u3001seaborn\u3001r [&hellip;]","protected":false},"author":3,"featured_media":985431,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/985424"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=985424"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/985424\/revisions"}],"predecessor-version":[{"id":985434,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/985424\/revisions\/985434"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/985431"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=985424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=985424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=985424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}