{"id":1101385,"date":"2025-01-08T15:49:18","date_gmt":"2025-01-08T07:49:18","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1101385.html"},"modified":"2025-01-08T15:49:21","modified_gmt":"2025-01-08T07:49:21","slug":"python%e5%a6%82%e4%bd%95%e5%b0%86%e8%8e%b7%e5%8f%96%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ad%98%e4%b8%bacsv-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1101385.html","title":{"rendered":"python\u5982\u4f55\u5c06\u83b7\u53d6\u7684\u6570\u636e\u5b58\u4e3acsv"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064206\/38b76adf-f6c5-4fc0-9fbf-b44d07b16b37.webp\" alt=\"python\u5982\u4f55\u5c06\u83b7\u53d6\u7684\u6570\u636e\u5b58\u4e3acsv\" \/><\/p>\n<p><p> <strong>Python\u5c06\u83b7\u53d6\u7684\u6570\u636e\u5b58\u4e3aCSV\u7684\u6b65\u9aa4\u5305\u62ec\u4f7f\u7528pandas\u5e93\u3001csv\u5e93\u3001\u6b63\u786e\u7684\u6570\u636e\u683c\u5f0f\u51c6\u5907\u3001\u6587\u4ef6\u8def\u5f84\u8bbe\u5b9a\u3001\u6570\u636e\u5199\u5165\u7b49<\/strong>\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e00\u6b65\u7684\u64cd\u4f5c\uff0c\u5e76\u7ed9\u51fa\u5b9e\u7528\u7684\u4ee3\u7801\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Pandas\u5e93<\/h3>\n<\/p>\n<p><p>Pandas\u5e93\u662fPython\u4e2d\u7528\u4e8e\u6570\u636e\u64cd\u4f5c\u548c\u5206\u6790\u7684\u5f3a\u5927\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u4e86\u76f4\u63a5\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u7684\u65b9\u6cd5\uff0c\u9002\u7528\u4e8e\u5904\u7406\u8868\u683c\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Pandas\u5e93<\/h4>\n<\/p>\n<p><p>\u5728\u4f7f\u7528Pandas\u5e93\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u4fdd\u5b83\u5df2\u7ecf\u5b89\u88c5\u5728\u60a8\u7684Python\u73af\u5883\u4e2d\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u51c6\u5907\u6570\u636e<\/h4>\n<\/p>\n<p><p>\u51c6\u5907\u4e00\u4e2a\u5305\u542b\u6570\u636e\u7684\u5b57\u5178\u6216DataFrame\u5bf9\u8c61\uff0c\u8fd9\u662f\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u7684\u57fa\u7840\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5b57\u5178<\/strong><\/h2>\n<p>data = {<\/p>\n<p>    &#39;Name&#39;: [&#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;],<\/p>\n<p>    &#39;Age&#39;: [25, 30, 35],<\/p>\n<p>    &#39;City&#39;: [&#39;New York&#39;, &#39;Los Angeles&#39;, &#39;Chicago&#39;]<\/p>\n<p>}<\/p>\n<h2><strong>\u5c06\u5b57\u5178\u8f6c\u6362\u4e3aDataFrame<\/strong><\/h2>\n<p>df = pd.DataFrame(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>to_csv<\/code>\u65b9\u6cd5\u5c06DataFrame\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528CSV\u5e93<\/h3>\n<\/p>\n<p><p>Python\u5185\u7f6e\u7684csv\u5e93\u4e5f\u53ef\u4ee5\u7528\u6765\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u3002\u9002\u7528\u4e8e\u8f83\u4e3a\u7b80\u5355\u7684\u6570\u636e\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5bfc\u5165CSV\u5e93<\/h4>\n<\/p>\n<p><p>CSV\u5e93\u662fPython\u7684\u6807\u51c6\u5e93\uff0c\u65e0\u9700\u5b89\u88c5\uff0c\u76f4\u63a5\u5bfc\u5165\u5373\u53ef\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import csv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u51c6\u5907\u6570\u636e<\/h4>\n<\/p>\n<p><p>\u51c6\u5907\u4e00\u4e2a\u5305\u542b\u6570\u636e\u7684\u5217\u8868\u6216\u5b57\u5178\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [<\/p>\n<p>    {&#39;Name&#39;: &#39;Alice&#39;, &#39;Age&#39;: 25, &#39;City&#39;: &#39;New York&#39;},<\/p>\n<p>    {&#39;Name&#39;: &#39;Bob&#39;, &#39;Age&#39;: 30, &#39;City&#39;: &#39;Los Angeles&#39;},<\/p>\n<p>    {&#39;Name&#39;: &#39;Charlie&#39;, &#39;Age&#39;: 35, &#39;City&#39;: &#39;Chicago&#39;}<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528csv\u5e93\u7684<code>DictWriter<\/code>\u7c7b\u5c06\u6570\u636e\u5199\u5165CSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;output.csv&#39;, mode=&#39;w&#39;, newline=&#39;&#39;) as file:<\/p>\n<p>    writer = csv.DictWriter(file, fieldnames=[&#39;Name&#39;, &#39;Age&#39;, &#39;City&#39;])<\/p>\n<p>    writer.writeheader()<\/p>\n<p>    for row in data:<\/p>\n<p>        writer.writerow(row)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u6570\u636e\u683c\u5f0f\u51c6\u5907<\/h3>\n<\/p>\n<p><p>\u5728\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u4e4b\u524d\uff0c\u786e\u4fdd\u6570\u636e\u683c\u5f0f\u6b63\u786e\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u5e38\u89c1\u7684\u6570\u636e\u683c\u5f0f\u5305\u62ec\u5217\u8868\u3001\u5b57\u5178\u548cDataFrame\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5217\u8868\u683c\u5f0f<\/h4>\n<\/p>\n<p><p>\u5217\u8868\u683c\u5f0f\u9002\u7528\u4e8e\u7b80\u5355\u7684\u884c\u5217\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [<\/p>\n<p>    [&#39;Name&#39;, &#39;Age&#39;, &#39;City&#39;],<\/p>\n<p>    [&#39;Alice&#39;, 25, &#39;New York&#39;],<\/p>\n<p>    [&#39;Bob&#39;, 30, &#39;Los Angeles&#39;],<\/p>\n<p>    [&#39;Charlie&#39;, 35, &#39;Chicago&#39;]<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5b57\u5178\u683c\u5f0f<\/h4>\n<\/p>\n<p><p>\u5b57\u5178\u683c\u5f0f\u9002\u7528\u4e8e\u5177\u6709\u952e\u503c\u5bf9\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [<\/p>\n<p>    {&#39;Name&#39;: &#39;Alice&#39;, &#39;Age&#39;: 25, &#39;City&#39;: &#39;New York&#39;},<\/p>\n<p>    {&#39;Name&#39;: &#39;Bob&#39;, &#39;Age&#39;: 30, &#39;City&#39;: &#39;Los Angeles&#39;},<\/p>\n<p>    {&#39;Name&#39;: &#39;Charlie&#39;, &#39;Age&#39;: 35, &#39;City&#39;: &#39;Chicago&#39;}<\/p>\n<p>]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001DataFrame\u683c\u5f0f<\/h4>\n<\/p>\n<p><p>DataFrame\u683c\u5f0f\u9002\u7528\u4e8e\u8868\u683c\u6570\u636e\uff0c\u901a\u5e38\u7531Pandas\u5e93\u751f\u6210\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>data = {<\/p>\n<p>    &#39;Name&#39;: [&#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;],<\/p>\n<p>    &#39;Age&#39;: [25, 30, 35],<\/p>\n<p>    &#39;City&#39;: [&#39;New York&#39;, &#39;Los Angeles&#39;, &#39;Chicago&#39;]<\/p>\n<p>}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u6587\u4ef6\u8def\u5f84\u8bbe\u5b9a<\/h3>\n<\/p>\n<p><p>\u5728\u4fdd\u5b58CSV\u6587\u4ef6\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\u3002\u53ef\u4ee5\u662f\u76f8\u5bf9\u8def\u5f84\u6216\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u76f8\u5bf9\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u76f8\u5bf9\u8def\u5f84\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u7684\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u7edd\u5bf9\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u7edd\u5bf9\u8def\u5f84\u662f\u6587\u4ef6\u5728\u7cfb\u7edf\u4e2d\u7684\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;\/path\/to\/your\/directory\/output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u6570\u636e\u5199\u5165<\/h3>\n<\/p>\n<p><p>\u5728\u5c06\u6570\u636e\u5199\u5165CSV\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e9b\u9009\u9879\uff0c\u5982\u662f\u5426\u5199\u5165\u7d22\u5f15\u3001\u5206\u9694\u7b26\u3001\u7f16\u7801\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5199\u5165\u7d22\u5f15<\/h4>\n<\/p>\n<p><p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cPandas\u4f1a\u5c06DataFrame\u7684\u7d22\u5f15\u5199\u5165CSV\u6587\u4ef6\u3002\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code>index=False<\/code>\u6765\u907f\u514d\u5199\u5165\u7d22\u5f15\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u8bbe\u7f6e\u5206\u9694\u7b26<\/h4>\n<\/p>\n<p><p>\u9ed8\u8ba4\u7684\u5206\u9694\u7b26\u662f\u9017\u53f7\uff08<code>,<\/code>\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7<code>sep<\/code>\u53c2\u6570\u8bbe\u7f6e\u5176\u4ed6\u5206\u9694\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;output.csv&#39;, sep=&#39;;&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u8bbe\u7f6e\u7f16\u7801<\/h4>\n<\/p>\n<p><p>\u9ed8\u8ba4\u7684\u7f16\u7801\u662fUTF-8\uff0c\u53ef\u4ee5\u901a\u8fc7<code>encoding<\/code>\u53c2\u6570\u8bbe\u7f6e\u5176\u4ed6\u7f16\u7801\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">df.to_csv(&#39;output.csv&#39;, encoding=&#39;utf-8&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528Pandas\u5e93\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5b57\u5178<\/strong><\/h2>\n<p>data = {<\/p>\n<p>    &#39;Name&#39;: [&#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;],<\/p>\n<p>    &#39;Age&#39;: [25, 30, 35],<\/p>\n<p>    &#39;City&#39;: [&#39;New York&#39;, &#39;Los Angeles&#39;, &#39;Chicago&#39;]<\/p>\n<p>}<\/p>\n<h2><strong>\u5c06\u5b57\u5178\u8f6c\u6362\u4e3aDataFrame<\/strong><\/h2>\n<p>df = pd.DataFrame(data)<\/p>\n<h2><strong>\u5c06DataFrame\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6<\/strong><\/h2>\n<p>df.to_csv(&#39;output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p><strong>\u4f7f\u7528Pandas\u5e93\u3001CSV\u5e93\u3001\u6b63\u786e\u7684\u6570\u636e\u683c\u5f0f\u51c6\u5907\u3001\u6587\u4ef6\u8def\u5f84\u8bbe\u5b9a\u3001\u6570\u636e\u5199\u5165\u7b49\u6b65\u9aa4<\/strong>\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06Python\u83b7\u53d6\u7684\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u3002Pandas\u5e93\u9002\u7528\u4e8e\u5904\u7406\u590d\u6742\u7684\u8868\u683c\u6570\u636e\uff0c\u800cCSV\u5e93\u5219\u9002\u7528\u4e8e\u7b80\u5355\u7684\u6570\u636e\u64cd\u4f5c\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u6570\u636e\u7684\u590d\u6742\u7a0b\u5ea6\u548c\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u60a8\u5e94\u8be5\u5df2\u7ecf\u4e86\u89e3\u4e86\u5982\u4f55\u5c06Python\u83b7\u53d6\u7684\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\u7684\u8be6\u7ec6\u6b65\u9aa4\u548c\u4ee3\u7801\u793a\u4f8b\u3002\u5e0c\u671b\u8fd9\u4e9b\u5185\u5bb9\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5c06\u6570\u636e\u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\uff1f<\/strong><br \/>\u4f7f\u7528Python\u4fdd\u5b58\u6570\u636e\u4e3aCSV\u683c\u5f0f\u975e\u5e38\u7b80\u5355\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>csv<\/code>\u6a21\u5757\u6216\u6d41\u884c\u7684<code>pandas<\/code>\u5e93\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528<code>pandas<\/code>\u7684\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">import pandas as pd\n\n# \u5047\u8bbe\u60a8\u7684\u6570\u636e\u662f\u4e00\u4e2a\u5b57\u5178\u6216\u5217\u8868\ndata = {\n    &#39;\u540d\u79f0&#39;: [&#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;],\n    &#39;\u5e74\u9f84&#39;: [25, 30, 35]\n}\n\n# \u8f6c\u6362\u4e3aDataFrame\ndf = pd.DataFrame(data)\n\n# \u4fdd\u5b58\u4e3aCSV\u6587\u4ef6\ndf.to_csv(&#39;output.csv&#39;, index=False, encoding=&#39;utf-8&#39;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u9ad8\u6548\uff0c\u800c\u4e14\u53ef\u4ee5\u8f7b\u677e\u5904\u7406\u5927\u91cf\u6570\u636e\u3002<\/p>\n<p><strong>\u5728\u4fdd\u5b58CSV\u6587\u4ef6\u65f6\uff0c\u6709\u54ea\u4e9b\u53c2\u6570\u53ef\u4ee5\u914d\u7f6e\uff1f<\/strong><br \/>\u5728\u4f7f\u7528<code>pandas<\/code>\u7684<code>to_csv<\/code>\u65b9\u6cd5\u65f6\uff0c\u60a8\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a\u53c2\u6570\uff0c\u4f8b\u5982\uff1a  <\/p>\n<ul>\n<li><code>sep<\/code>: \u6307\u5b9a\u5206\u9694\u7b26\uff0c\u9ed8\u8ba4\u4e3a\u9017\u53f7\uff08<code>,<\/code>\uff09\u3002\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u5176\u4ed6\u7b26\u53f7\uff0c\u5982\u5206\u53f7\uff08<code>;<\/code>\uff09\u3002<\/li>\n<li><code>header<\/code>: \u662f\u5426\u5199\u5165\u5217\u540d\uff0c\u9ed8\u8ba4\u4e3a<code>True<\/code>\u3002<\/li>\n<li><code>index<\/code>: \u662f\u5426\u5199\u5165\u884c\u7d22\u5f15\uff0c\u9ed8\u8ba4\u4e3a<code>True<\/code>\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u4e3a<code>False<\/code>\u4ee5\u7701\u7565\u7d22\u5f15\u3002<\/li>\n<li><code>encoding<\/code>: \u8bbe\u7f6e\u6587\u4ef6\u7f16\u7801\u683c\u5f0f\uff0c\u4f8b\u5982<code>utf-8<\/code>\u6216<code>utf-16<\/code>\uff0c\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u8c03\u6574\u8fd9\u4e9b\u53c2\u6570\uff0c\u60a8\u53ef\u4ee5\u6ee1\u8db3\u7279\u5b9a\u9700\u6c42\u3002<\/p>\n<p><strong>\u5982\u679c\u6570\u636e\u4e2d\u5305\u542b\u7279\u6b8a\u5b57\u7b26\uff0c\u8be5\u5982\u4f55\u5904\u7406\uff1f<\/strong><br \/>\u5728\u5904\u7406\u5305\u542b\u7279\u6b8a\u5b57\u7b26\u7684\u6570\u636e\u65f6\uff0c\u786e\u4fdd\u4f7f\u7528\u6b63\u786e\u7684\u7f16\u7801\u683c\u5f0f\u975e\u5e38\u91cd\u8981\u3002<code>pandas<\/code>\u7684<code>to_csv<\/code>\u65b9\u6cd5\u5141\u8bb8\u8bbe\u7f6e<code>encoding<\/code>\u53c2\u6570\uff0c\u5efa\u8bae\u4f7f\u7528<code>utf-8<\/code>\u6216<code>utf-8-sig<\/code>\uff0c\u4ee5\u907f\u514d\u51fa\u73b0\u4e71\u7801\u3002\u6b64\u5916\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u8bbe\u7f6e<code>quoting<\/code>\u53c2\u6570\uff0c\u4f8b\u5982<code>quoting=csv.QUOTE_NONNUMERIC<\/code>\uff0c\u4ee5\u5904\u7406\u5305\u542b\u9017\u53f7\u6216\u5176\u4ed6\u5206\u9694\u7b26\u7684\u5b57\u6bb5\uff0c\u786e\u4fdd\u6570\u636e\u7684\u5b8c\u6574\u6027\u548c\u51c6\u786e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5c06\u83b7\u53d6\u7684\u6570\u636e\u5b58\u4e3aCSV\u7684\u6b65\u9aa4\u5305\u62ec\u4f7f\u7528pandas\u5e93\u3001csv\u5e93\u3001\u6b63\u786e\u7684\u6570\u636e\u683c\u5f0f\u51c6\u5907\u3001\u6587\u4ef6\u8def\u5f84\u8bbe\u5b9a\u3001\u6570 [&hellip;]","protected":false},"author":3,"featured_media":1101396,"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\/1101385"}],"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=1101385"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1101385\/revisions"}],"predecessor-version":[{"id":1101401,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1101385\/revisions\/1101401"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1101396"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1101385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1101385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1101385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}