{"id":1133904,"date":"2025-01-08T21:11:02","date_gmt":"2025-01-08T13:11:02","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1133904.html"},"modified":"2025-01-08T21:11:08","modified_gmt":"2025-01-08T13:11:08","slug":"python%e5%a6%82%e4%bd%95%e5%b0%86%e4%b8%80%e7%bb%b4%e5%88%97%e8%a1%a8%e6%8c%89%e8%a1%8c%e7%b4%a2%e5%bc%95","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1133904.html","title":{"rendered":"python\u5982\u4f55\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25103015\/00eae171-aac2-4104-97c4-68dbdc871f8e.webp\" alt=\"python\u5982\u4f55\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\" \/><\/p>\n<p><p> <strong>Python\u4e2d\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\u8fdb\u884c\u5904\u7406\uff0c\u5305\u62ec\u5217\u8868\u89e3\u6790\u3001NumPy\u5e93\u3001pandas\u5e93\u7b49<\/strong>\u3002\u5176\u4e2d\uff0c<strong>\u5217\u8868\u89e3\u6790<\/strong>\u662f\u4e00\u79cd\u7b80\u4fbf\u4e14Pythonic\u7684\u65b9\u6cd5\uff0c<strong>NumPy\u5e93<\/strong>\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u7ec4\u64cd\u4f5c\u529f\u80fd\uff0c\u800c<strong>pandas\u5e93<\/strong>\u5219\u9002\u7528\u4e8e\u6570\u636e\u5206\u6790\u573a\u666f\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u51e0\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\u7684\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528\u5217\u8868\u89e3\u6790<\/h3>\n<\/p>\n<p><p>\u5217\u8868\u89e3\u6790\u662fPython\u4e2d\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5728\u4e00\u884c\u4ee3\u7801\u4e2d\u5b8c\u6210\u590d\u6742\u7684\u5217\u8868\u64cd\u4f5c\u3002\u901a\u8fc7\u5217\u8868\u89e3\u6790\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u7167\u6307\u5b9a\u7684\u884c\u7d22\u5f15\u8fdb\u884c\u5206\u5272\u6216\u91cd\u7ec4\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>one_d_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/p>\n<p>row_length = 3<\/p>\n<p>two_d_list = [one_d_list[i:i+row_length] for i in range(0, len(one_d_list), row_length)]<\/p>\n<p>print(two_d_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u6bcf\u884c3\u4e2a\u5143\u7d20\u8fdb\u884c\u5206\u5272\uff0c\u751f\u6210\u4e00\u4e2a\u4e8c\u7ef4\u5217\u8868\u3002\u901a\u8fc7\u5217\u8868\u89e3\u6790\uff0c\u4ee3\u7801\u7b80\u6d01\u660e\u4e86\uff0c\u9002\u7528\u4e8e\u5c0f\u89c4\u6a21\u6570\u636e\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528NumPy\u5e93<\/h3>\n<\/p>\n<p><p>NumPy\u662fPython\u4e2d\u5904\u7406\u6570\u7ec4\u548c\u77e9\u9635\u7684\u5f3a\u5927\u5e93\uff0c\u901a\u8fc7NumPy\u53ef\u4ee5\u9ad8\u6548\u5730\u8fdb\u884c\u591a\u7ef4\u6570\u7ec4\u7684\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>one_d_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/p>\n<p>row_length = 3<\/p>\n<p>two_d_array = np.array(one_d_list).reshape(-1, row_length)<\/p>\n<p>print(two_d_array)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7NumPy\u7684<code>reshape<\/code>\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u4e00\u7ef4\u6570\u7ec4\u91cd\u65b0\u8c03\u6574\u4e3a\u6307\u5b9a\u5f62\u72b6\u7684\u4e8c\u7ef4\u6570\u7ec4\u3002NumPy\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u65f6\u6027\u80fd\u4f18\u8d8a\uff0c\u9002\u5408\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528pandas\u5e93<\/h3>\n<\/p>\n<p><p>pandas\u662f\u6570\u636e\u5206\u6790\u9886\u57df\u6700\u5e38\u7528\u7684\u5e93\u4e4b\u4e00\uff0c\u901a\u8fc7pandas\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u6570\u636e\u7684\u8bfb\u53d6\u3001\u5904\u7406\u548c\u5206\u6790\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>one_d_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]<\/p>\n<p>row_length = 3<\/p>\n<p>df = pd.DataFrame([one_d_list[i:i+row_length] for i in range(0, len(one_d_list), row_length)])<\/p>\n<p>print(df)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7pandas\u7684<code>DataFrame<\/code>\u5bf9\u8c61\uff0c\u53ef\u4ee5\u5c06\u4e00\u7ef4\u5217\u8868\u8f6c\u6362\u4e3a\u4e8c\u7ef4\u6570\u636e\u8868\uff0c\u65b9\u4fbf\u540e\u7eed\u7684\u5206\u6790\u548c\u5904\u7406\u3002pandas\u9002\u5408\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u8be6\u7ec6\u63cf\u8ff0\uff1a\u5217\u8868\u89e3\u6790\u7684\u4f18\u70b9\u548c\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><p><strong>\u5217\u8868\u89e3\u6790<\/strong>\u662f\u4e00\u79cd\u7b80\u4fbf\u4e14Pythonic\u7684\u65b9\u6cd5\uff0c\u9002\u5408\u5904\u7406\u5c0f\u89c4\u6a21\u6570\u636e\u3002\u5176\u4e3b\u8981\u4f18\u70b9\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u4ee3\u7801\u7b80\u6d01\u660e\u4e86<\/strong>\uff1a\u5217\u8868\u89e3\u6790\u53ef\u4ee5\u5728\u4e00\u884c\u4ee3\u7801\u4e2d\u5b8c\u6210\u590d\u6742\u7684\u5217\u8868\u64cd\u4f5c\uff0c\u4f7f\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u6613\u8bfb\u3002<\/li>\n<li><strong>\u9ad8\u6548<\/strong>\uff1a\u5217\u8868\u89e3\u6790\u5728\u6267\u884c\u901f\u5ea6\u4e0a\u901a\u5e38\u6bd4\u666e\u901a\u5faa\u73af\u5feb\uff0c\u9002\u5408\u5904\u7406\u5c0f\u89c4\u6a21\u6570\u636e\u3002<\/li>\n<li><strong>\u6613\u4e8e\u8c03\u8bd5<\/strong>\uff1a\u5217\u8868\u89e3\u6790\u7684\u8bed\u6cd5\u7ed3\u6784\u6e05\u6670\uff0c\u6613\u4e8e\u8c03\u8bd5\u548c\u4fee\u6539\u3002<\/li>\n<\/ol>\n<p><p><strong>\u5e94\u7528\u573a\u666f<\/strong>\uff1a\u5217\u8868\u89e3\u6790\u9002\u7528\u4e8e\u9700\u8981\u5bf9\u5217\u8868\u8fdb\u884c\u7b80\u5355\u8f6c\u6362\u6216\u8fc7\u6ee4\u7684\u573a\u666f\uff0c\u5982\u5206\u5272\u5217\u8868\u3001\u7b5b\u9009\u5143\u7d20\u3001\u751f\u6210\u65b0\u7684\u5217\u8868\u7b49\u3002\u4f8b\u5982\uff0c\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\u5206\u5272\u4e3a\u4e8c\u7ef4\u5217\u8868\u3001\u7b5b\u9009\u51fa\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u5143\u7d20\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5217\u8868\u89e3\u6790\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u5904\u7406\u8fc7\u7a0b\u4e2d\u63d0\u9ad8\u4ee3\u7801\u7684\u7b80\u6d01\u6027\u548c\u53ef\u8bfb\u6027\uff0c\u9002\u5408\u5904\u7406\u7b80\u5355\u7684\u5217\u8868\u64cd\u4f5c\u3002\u4f46\u5bf9\u4e8e\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\uff0c\u5efa\u8bae\u4f7f\u7528NumPy\u6216pandas\u7b49\u4e13\u4e1a\u5e93\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001NumPy\u7684\u4f18\u52bf\u548c\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><p><strong>NumPy<\/strong>\u662fPython\u4e2d\u5904\u7406\u6570\u7ec4\u548c\u77e9\u9635\u7684\u5f3a\u5927\u5e93\uff0c\u5177\u6709\u9ad8\u6548\u7684\u6570\u7ec4\u64cd\u4f5c\u529f\u80fd\u3002\u5176\u4e3b\u8981\u4f18\u70b9\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u9ad8\u6548\u6027\u80fd<\/strong>\uff1aNumPy\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u65f6\u6027\u80fd\u4f18\u8d8a\uff0c\u9002\u5408\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u3002<\/li>\n<li><strong>\u4e30\u5bcc\u7684\u51fd\u6570\u5e93<\/strong>\uff1aNumPy\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u7ec4\u64cd\u4f5c\u51fd\u6570\uff0c\u5982\u6570\u5b66\u8fd0\u7b97\u3001\u7edf\u8ba1\u5206\u6790\u3001\u7ebf\u6027\u4ee3\u6570\u7b49\u3002<\/li>\n<li><strong>\u652f\u6301\u591a\u7ef4\u6570\u7ec4<\/strong>\uff1aNumPy\u53ef\u4ee5\u65b9\u4fbf\u5730\u5904\u7406\u591a\u7ef4\u6570\u7ec4\uff0c\u9002\u5408\u590d\u6742\u7684\u6570\u636e\u7ed3\u6784\u3002<\/li>\n<\/ol>\n<p><p><strong>\u5e94\u7528\u573a\u666f<\/strong>\uff1aNumPy\u9002\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u3001<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u3001\u6570\u636e\u5206\u6790\u7b49\u9700\u8981\u9ad8\u6548\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u7684\u573a\u666f\u3002\u4f8b\u5982\uff0c\u77e9\u9635\u8fd0\u7b97\u3001\u6570\u636e\u8f6c\u6362\u3001\u7edf\u8ba1\u5206\u6790\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7NumPy\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u5904\u7406\u4e2d\u63d0\u9ad8\u6548\u7387\u548c\u6027\u80fd\uff0c\u9002\u5408\u5904\u7406\u590d\u6742\u7684\u6570\u7ec4\u64cd\u4f5c\u3002\u5728\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\u9886\u57df\uff0cNumPy\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001pandas\u7684\u4f18\u52bf\u548c\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><p><strong>pandas<\/strong>\u662f\u6570\u636e\u5206\u6790\u9886\u57df\u6700\u5e38\u7528\u7684\u5e93\u4e4b\u4e00\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u529f\u80fd\u3002\u5176\u4e3b\u8981\u4f18\u70b9\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u5f3a\u5927\u7684\u6570\u636e\u7ed3\u6784<\/strong>\uff1apandas\u63d0\u4f9b\u4e86<code>Series<\/code>\u548c<code>DataFrame<\/code>\u4e24\u79cd\u5f3a\u5927\u7684\u6570\u636e\u7ed3\u6784\uff0c\u9002\u5408\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\u3002<\/li>\n<li><strong>\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u51fd\u6570<\/strong>\uff1apandas\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u51fd\u6570\uff0c\u5982\u6570\u636e\u8bfb\u53d6\u3001\u6e05\u6d17\u3001\u8f6c\u6362\u3001\u5206\u6790\u7b49\u3002<\/li>\n<li><strong>\u6613\u4e8e\u96c6\u6210<\/strong>\uff1apandas\u53ef\u4ee5\u65b9\u4fbf\u5730\u4e0e\u5176\u4ed6\u6570\u636e\u5206\u6790\u5de5\u5177\u548c\u5e93\u96c6\u6210\uff0c\u5982NumPy\u3001Matplotlib\u7b49\u3002<\/li>\n<\/ol>\n<p><p><strong>\u5e94\u7528\u573a\u666f<\/strong>\uff1apandas\u9002\u7528\u4e8e\u6570\u636e\u5206\u6790\u3001\u6570\u636e\u6e05\u6d17\u3001\u6570\u636e\u53ef\u89c6\u5316\u7b49\u9700\u8981\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\u7684\u573a\u666f\u3002\u4f8b\u5982\uff0c\u8bfb\u53d6CSV\u6587\u4ef6\u3001\u5904\u7406\u7f3a\u5931\u6570\u636e\u3001\u751f\u6210\u7edf\u8ba1\u62a5\u544a\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7pandas\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u5206\u6790\u8fc7\u7a0b\u4e2d\u63d0\u9ad8\u6548\u7387\u548c\u51c6\u786e\u6027\uff0c\u9002\u5408\u5904\u7406\u590d\u6742\u7684\u7ed3\u6784\u5316\u6570\u636e\u3002\u5728\u6570\u636e\u79d1\u5b66\u548c\u6570\u636e\u5206\u6790\u9886\u57df\uff0cpandas\u662f\u5fc5\u5907\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u4e2d\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\u8fdb\u884c\u5904\u7406\uff0c\u5305\u62ec\u5217\u8868\u89e3\u6790\u3001NumPy\u5e93\u3001pandas\u5e93\u7b49\u3002<strong>\u5217\u8868\u89e3\u6790<\/strong>\u9002\u7528\u4e8e\u5c0f\u89c4\u6a21\u6570\u636e\u5904\u7406\uff0c\u4ee3\u7801\u7b80\u6d01\u660e\u4e86\uff1b<strong>NumPy<\/strong>\u9002\u7528\u4e8e\u5927\u89c4\u6a21\u6570\u636e\u5904\u7406\uff0c\u6027\u80fd\u4f18\u8d8a\uff0c\u9002\u5408\u79d1\u5b66\u8ba1\u7b97\u548c\u6570\u636e\u5206\u6790\uff1b<strong>pandas<\/strong>\u9002\u7528\u4e8e\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\u529f\u80fd\uff0c\u9002\u5408\u6570\u636e\u5206\u6790\u548c\u6570\u636e\u6e05\u6d17\u3002\u6839\u636e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u548c\u51c6\u786e\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5c06\u4e00\u7ef4\u5217\u8868\u8f6c\u6362\u4e3a\u591a\u7ef4\u6570\u7ec4\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528NumPy\u5e93\u5c06\u4e00\u7ef4\u5217\u8868\u8f6c\u6362\u4e3a\u591a\u7ef4\u6570\u7ec4\u3002\u9996\u5148\u9700\u8981\u5b89\u88c5NumPy\u5e93\uff0c\u7136\u540e\u4f7f\u7528<code>reshape<\/code>\u51fd\u6570\u6765\u6539\u53d8\u6570\u7ec4\u7684\u5f62\u72b6\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u5305\u542b12\u4e2a\u5143\u7d20\u7684\u4e00\u7ef4\u5217\u8868\uff0c\u4f60\u53ef\u4ee5\u5c06\u5176\u8f6c\u6362\u4e3a3\u884c4\u5217\u7684\u4e8c\u7ef4\u6570\u7ec4\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">import numpy as np\n\none_d_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\ntwo_d_array = np.array(one_d_list).reshape(3, 4)\nprint(two_d_array)\n<\/code><\/pre>\n<p><strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u6309\u7279\u5b9a\u7684\u884c\u548c\u5217\u5207\u7247\u4e00\u7ef4\u5217\u8868\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5217\u8868\u63a8\u5bfc\u5f0f\u6765\u5b9e\u73b0\u6309\u884c\u548c\u5217\u5207\u7247\u64cd\u4f5c\u3002\u5047\u8bbe\u4f60\u6709\u4e00\u4e2a\u4e00\u7ef4\u5217\u8868\uff0c\u5e76\u5e0c\u671b\u6309\u6307\u5b9a\u7684\u884c\u548c\u5217\u6765\u83b7\u53d6\u5b50\u5217\u8868\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a  <\/p>\n<pre><code class=\"language-python\">one_d_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nrows, cols = 2, 5\nsliced_list = [one_d_list[i:i + cols] for i in range(0, len(one_d_list), cols)][:rows]\nprint(sliced_list)\n<\/code><\/pre>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u5f97\u5230\u6309\u884c\u548c\u5217\u5207\u7247\u540e\u7684\u7ed3\u679c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u5904\u7406\u4e00\u7ef4\u5217\u8868\u7684\u884c\u7d22\u5f15\uff1f<\/strong><br \/>\u5982\u679c\u60f3\u8981\u83b7\u53d6\u4e00\u7ef4\u5217\u8868\u4e2d\u6bcf\u4e2a\u5143\u7d20\u7684\u884c\u7d22\u5f15\uff0c\u53ef\u4ee5\u4f7f\u7528<code>enumerate<\/code>\u51fd\u6570\u6765\u5b9e\u73b0\u3002\u8fd9\u4f1a\u8fd4\u56de\u5143\u7d20\u53ca\u5176\u5bf9\u5e94\u7684\u7d22\u5f15\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">one_d_list = [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;]\nfor index, value in enumerate(one_d_list):\n    print(f&#39;Element: {value}, Row Index: {index}&#39;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5feb\u901f\u83b7\u53d6\u6bcf\u4e2a\u5143\u7d20\u7684\u884c\u7d22\u5f15\uff0c\u9002\u7528\u4e8e\u9700\u8981\u8ddf\u8e2a\u4f4d\u7f6e\u7684\u573a\u666f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u4e2d\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u5c06\u4e00\u7ef4\u5217\u8868\u6309\u884c\u7d22\u5f15\u8fdb\u884c\u5904\u7406\uff0c\u5305\u62ec\u5217\u8868\u89e3\u6790\u3001NumPy\u5e93\u3001pandas\u5e93\u7b49\u3002\u5176\u4e2d\uff0c [&hellip;]","protected":false},"author":3,"featured_media":1133921,"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\/1133904"}],"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=1133904"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1133904\/revisions"}],"predecessor-version":[{"id":1133925,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1133904\/revisions\/1133925"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1133921"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1133904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1133904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1133904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}