{"id":63303,"date":"2026-01-21T20:16:46","date_gmt":"2026-01-21T12:16:46","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/63303.html"},"modified":"2026-01-21T20:16:46","modified_gmt":"2026-01-21T12:16:46","slug":"%e5%ad%98%e8%b4%a7%e6%94%b6%e5%8f%91%e5%ad%98%e6%a0%b8%e7%ae%97%ef%bc%88%e5%85%88%e8%bf%9b%e5%85%88%e5%87%ba%e6%b3%95%ef%bc%89-pandas-%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/63303.html","title":{"rendered":"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0"},"content":{"rendered":"<h3 id=\"%E4%B8%80%E3%80%81%E7%94%9F%E6%88%90%E6%B5%8B%E8%AF%95%20Excel%20%E6%95%B0%E6%8D%AE%EF%BC%88%E4%B8%A4%E5%B9%B4%E6%95%B0%E6%8D%AE%EF%BC%8C%E6%AF%8F%E6%9C%88%E7%BA%A6%205%20%E4%B8%87%E8%A1%8C%EF%BC%89\">\u4e00\u3001\u751f\u6210\u6d4b\u8bd5 Excel \u6570\u636e&#xff08;\u4e24\u5e74\u6570\u636e&#xff0c;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff09;<\/h3>\n<h4 id=\"%E6%A0%B8%E5%BF%83%E6%80%9D%E8%B7%AF\">\u6838\u5fc3\u601d\u8def<\/h4>\n<li>\u751f\u6210\u65f6\u95f4\u8303\u56f4&#xff1a;2 \u5e74&#xff08;24 \u4e2a\u6708&#xff09;&#xff0c;\u6309\u81ea\u7136\u6708\u5212\u5206<\/li>\n<li>\u5b58\u8d27\u5c5e\u6027&#xff1a;\u6309\u6279\u6b21\u7ba1\u7406&#xff0c;\u5305\u542b\u7269\u6599\u7f16\u7801\u3001\u6279\u6b21\u53f7\u3001\u4ed3\u5e93\u7f16\u7801\u7b49\u6838\u5fc3\u5b57\u6bb5<\/li>\n<li>\u4e1a\u52a1\u7c7b\u578b&#xff1a;\u8986\u76d6\u91c7\u8d2d\u5165\u5e93\u3001\u9500\u552e\u51fa\u5e93\u3001\u54c1\u79cd\u8c03\u6574\u51fa\u5165\u5e93\u3001\u8c03\u62e8\u51fa\u5165\u5e93\u3001\u76d8\u4e8f\u76d8\u76c8<\/li>\n<li>\u6570\u636e\u91cf&#xff1a;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff0c;24 \u4e2a\u6708\u603b\u8ba1\u7ea6 120 \u4e07\u884c&#xff0c;\u5206\u6708\u751f\u6210 Excel \u6587\u4ef6&#xff08;\u4fbf\u4e8e\u6708\u5ea6\u6eda\u52a8\u8ba1\u7b97&#xff09;<\/li>\n<p>def generate_inventory_excel(target_dir, years&#061;2):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u751f\u6210\u5b58\u8d27\u6536\u53d1\u5b58\u6d4b\u8bd5Excel\u6570\u636e<br \/>\n    :param target_dir: \u76ee\u6807\u4fdd\u5b58\u76ee\u5f55<br \/>\n    :param years: \u751f\u6210\u6570\u636e\u7684\u5e74\u6570<br \/>\n    &#034;&#034;&#034;<br \/>\n    # 1. \u5b9a\u4e49\u57fa\u7840\u914d\u7f6e\u6570\u636e<br \/>\n    material_codes &#061; [f&#039;MAT{str(i).zfill(6)}&#039; for i in range(1, 200)]  # 200\u79cd\u7269\u6599<br \/>\n    warehouse_codes &#061; [f&#039;WH{str(i).zfill(3)}&#039; for i in range(1, 50)]   # 50\u4e2a\u4ed3\u5e93<br \/>\n    business_types &#061; [<br \/>\n        &#039;\u91c7\u8d2d\u5165\u5e93&#039;, &#039;\u9500\u552e\u51fa\u5e93&#039;,<br \/>\n        &#039;\u54c1\u79cd\u8c03\u6574\u5165\u5e93&#039;, &#039;\u54c1\u79cd\u8c03\u6574\u51fa\u5e93&#039;,<br \/>\n        &#039;\u8c03\u62e8\u5165\u5e93&#039;, &#039;\u8c03\u62e8\u51fa\u5e93&#039;,<br \/>\n        &#039;\u76d8\u76c8&#039;, &#039;\u76d8\u4e8f&#039;<br \/>\n    ]<br \/>\n    # \u4e1a\u52a1\u7c7b\u578b\u5bf9\u5e94\u6536\u53d1\u6807\u8bc6&#xff08;\u5165\u5e93&#061;1&#xff0c;\u51fa\u5e93&#061;-1&#xff0c;\u7528\u4e8e\u540e\u7eed\u6570\u91cf\u8ba1\u7b97&#xff09;<br \/>\n    biz_type_flag &#061; {<br \/>\n        &#039;\u91c7\u8d2d\u5165\u5e93&#039;: 1, &#039;\u9500\u552e\u51fa\u5e93&#039;: -1,<br \/>\n        &#039;\u54c1\u79cd\u8c03\u6574\u5165\u5e93&#039;: 1, &#039;\u54c1\u79cd\u8c03\u6574\u51fa\u5e93&#039;: -1,<br \/>\n        &#039;\u8c03\u62e8\u5165\u5e93&#039;: 1, &#039;\u8c03\u62e8\u51fa\u5e93&#039;: -1,<br \/>\n        &#039;\u76d8\u76c8&#039;: 1, &#039;\u76d8\u4e8f&#039;: -1<br \/>\n    }<\/p>\n<p>    # 2. \u8ba1\u7b97\u65f6\u95f4\u8303\u56f4&#xff08;\u4ece\u5f53\u524d\u65e5\u671f\u5f80\u524d\u63a82\u5e74&#xff0c;\u6309\u81ea\u7136\u6708\u62c6\u5206&#xff09;<br \/>\n    end_date &#061; datetime.now().replace(day&#061;1, hour&#061;0, minute&#061;0, second&#061;0, microsecond&#061;0)<br \/>\n    start_date &#061; (end_date &#8211; timedelta(days&#061;365*years)).replace(day&#061;1)<\/p>\n<p>    # 3. \u9010\u6708\u751f\u6210\u6570\u636e<br \/>\n    current_month &#061; start_date<br \/>\n    while current_month &lt; end_date:<br \/>\n        # \u83b7\u53d6\u5f53\u524d\u6708\u4efd\u7684\u8d77\u59cb\u548c\u7ed3\u675f\u65e5\u671f<br \/>\n        next_month &#061; (current_month &#043; timedelta(days&#061;32)).replace(day&#061;1)<br \/>\n        month_days &#061; (next_month &#8211; timedelta(days&#061;1)).day<br \/>\n        month_str &#061; current_month.strftime(&#039;%Y%m&#039;)<\/p>\n<p>        # 4. \u751f\u6210\u5f53\u6708\u6570\u636e&#xff08;\u7ea65\u4e07\u884c&#xff09;<br \/>\n        row_count &#061; 50000<br \/>\n        data &#061; {<br \/>\n            &#039;\u5355\u636e\u65e5\u671f&#039;: [current_month.replace(day&#061;random.randint(1, month_days)) for _ in range(row_count)],<br \/>\n            &#039;\u7269\u6599\u7f16\u7801&#039;: [random.choice(material_codes) for _ in range(row_count)],<br \/>\n            &#039;\u4ed3\u5e93\u7f16\u7801&#039;: [random.choice(warehouse_codes) for _ in range(row_count)],<br \/>\n            &#039;\u4e1a\u52a1\u7c7b\u578b&#039;: [random.choice(business_types) for _ in range(row_count)],<br \/>\n            &#039;\u6570\u91cf&#039;: np.random.randint(1, 100, size&#061;row_count),  # \u57fa\u7840\u6570\u91cf&#xff08;1-99&#xff09;<br \/>\n            &#039;\u5355\u4ef7&#039;: np.round(np.random.uniform(10, 1000, size&#061;row_count), 2),  # \u57fa\u7840\u5355\u4ef7&#xff08;10-1000&#xff0c;\u4fdd\u75592\u4f4d\u5c0f\u6570&#xff09;<br \/>\n            &#039;\u6279\u6b21\u53f7&#039;: [f&#039;BAT{current_month.strftime(&#034;%Y%m&#034;)}{str(i).zfill(6)}&#039; for i in range(row_count)]  # \u6309\u6708\u4efd\u751f\u6210\u6279\u6b21\u53f7<br \/>\n        }<\/p>\n<p>        # 5. \u5904\u7406\u51fa\u5165\u5e93\u6570\u91cf&#xff08;\u51fa\u5e93\u8f6c\u4e3a\u8d1f\u6570&#xff09;<br \/>\n        df &#061; pd.DataFrame(data)<br \/>\n        df[&#039;\u6570\u91cf&#039;] &#061; df.apply(lambda x: x[&#039;\u6570\u91cf&#039;] * biz_type_flag[x[&#039;\u4e1a\u52a1\u7c7b\u578b&#039;]], axis&#061;1)<\/p>\n<p>        # 6. \u8ba1\u7b97\u91d1\u989d&#xff08;\u6570\u91cf*\u5355\u4ef7&#xff0c;\u4fdd\u75592\u4f4d\u5c0f\u6570&#xff09;<br \/>\n        df[&#039;\u91d1\u989d&#039;] &#061; np.round(df[&#039;\u6570\u91cf&#039;] * df[&#039;\u5355\u4ef7&#039;], 2)<\/p>\n<p>        # 7. \u6392\u5e8f&#xff08;\u6309\u5355\u636e\u65e5\u671f\u3001\u7269\u6599\u7f16\u7801\u3001\u6279\u6b21\u53f7&#xff09;<br \/>\n        df &#061; df.sort_values(by&#061;[&#039;\u5355\u636e\u65e5\u671f&#039;, &#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u6279\u6b21\u53f7&#039;]).reset_index(drop&#061;True)<\/p>\n<p>        # 8. \u4fdd\u5b58\u4e3aExcel\u6587\u4ef6&#xff08;\u6309\u6708\u4efd\u547d\u540d&#xff0c;\u4fbf\u4e8e\u6708\u5ea6\u6eda\u52a8&#xff09;<br \/>\n        excel_path &#061; os.path.join(target_dir, f&#039;\u5b58\u8d27\u6536\u53d1\u5b58\u6d41\u6c34_{month_str}.xlsx&#039;)<br \/>\n        df.to_excel(excel_path, index&#061;False, engine&#061;&#039;openpyxl&#039;)<br \/>\n        print(f&#039;\u5df2\u751f\u6210\u5f53\u6708\u6570\u636e&#xff1a;{excel_path}&#039;)<\/p>\n<p>        # 9. \u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u6708<br \/>\n        current_month &#061; next_month<\/p>\n<p># \u8c03\u7528\u51fd\u6570\u751f\u62102\u5e74\u6d4b\u8bd5\u6570\u636e<br \/>\ngenerate_inventory_excel(target_dir, years&#061;2)<\/p>\n<h3 id=\"%E4%BA%8C%E3%80%81%E5%85%88%E8%BF%9B%E5%85%88%E5%87%BA%E6%B3%95%E6%A0%B8%E7%AE%97%E5%AE%9E%E7%8E%B0%EF%BC%88%E6%94%AF%E6%8C%81%E6%9C%88%E5%BA%A6%E6%BB%9A%E5%8A%A8%E8%AE%A1%E7%AE%97%EF%BC%89\">\u4e8c\u3001\u5148\u8fdb\u5148\u51fa\u6cd5\u6838\u7b97\u5b9e\u73b0&#xff08;\u652f\u6301\u6708\u5ea6\u6eda\u52a8\u8ba1\u7b97&#xff09;<\/h3>\n<h4 id=\"%E5%85%88%E8%BF%9B%E5%85%88%E5%87%BA%E6%B3%95%EF%BC%88FIFO%EF%BC%89%E6%A0%B8%E7%AE%97\">\u5148\u8fdb\u5148\u51fa\u6cd5&#xff08;FIFO&#xff09;\u6838\u7b97<\/h4>\n<p>\u5148\u8fdb\u5148\u51fa\u6cd5&#xff08;FIFO&#xff09;\u7684\u6838\u5fc3\u662f\u6309\u5165\u5e93\u65f6\u95f4\u5148\u540e\u987a\u5e8f\u5339\u914d\u51fa\u5e93&#xff0c;\u4f18\u5148\u6263\u51cf\u6700\u65e9\u5165\u5e93\u6279\u6b21\u7684\u5e93\u5b58&#xff0c;\u6eda\u52a8\u8ba1\u7b97\u7684\u6838\u5fc3\u662f\u300c\u4e0a\u6708\u671f\u672b\u6709\u6548\u7ed3\u5b58\u6279\u6b21&#xff08;\u5e26\u6570\u91cf \/ \u91d1\u989d \/ \u5355\u4ef7&#xff09;&#061; \u672c\u6708\u671f\u521d\u53ef\u7528\u6279\u6b21\u300d&#xff0c;\u5173\u952e\u8981\u70b9&#xff1a;<br \/>\n\u6838\u7b97\u7ef4\u5ea6&#xff1a;\u6309\u300c\u7269\u6599\u7f16\u7801 &#043; \u4ed3\u5e93\u7f16\u7801\u300d\u5206\u7ec4&#xff0c;\u6bcf\u7ec4\u5185\u5355\u72ec\u6267\u884c FIFO \u903b\u8f91&#xff08;\u4e0d\u540c\u7269\u6599 \/ \u4ed3\u5e93\u4e92\u4e0d\u5e72\u6270&#xff09;\u3002<br \/>\n\u5165\u5e93\u5904\u7406&#xff1a;\u76f4\u63a5\u8ffd\u52a0\u6279\u6b21\u4fe1\u606f&#xff08;\u6570\u91cf \/ \u91d1\u989d \/ \u5355\u4ef7&#xff09;\u5230\u5f53\u524d\u7ed3\u5b58\u5217\u8868&#xff0c;\u6309\u5165\u5e93\u65f6\u95f4\u6392\u5e8f\u3002<br \/>\n\u51fa\u5e93\u5904\u7406&#xff1a;\u6309\u6279\u6b21\u5165\u5e93\u5148\u540e\u987a\u5e8f\u9010\u6279\u6263\u51cf&#xff0c;\u5148\u6263\u5b8c\u6700\u65e9\u6279\u6b21&#xff0c;\u518d\u6263\u6b21\u65e9\u6279\u6b21&#xff0c;\u76f4\u81f3\u6ee1\u8db3\u51fa\u5e93\u6570\u91cf\u3002<br \/>\n\u671f\u672b\u7ed3\u5b58&#xff1a;\u5269\u4f59\u672a\u6263\u51cf\u7684\u6279\u6b21\u6784\u6210\u6708\u672b\u7ed3\u5b58&#xff0c;\u4f5c\u4e3a\u4e0b\u6708\u671f\u521d\u6570\u636e&#xff0c;\u4fdd\u6301\u6279\u6b21\u7684\u65f6\u95f4\u987a\u5e8f\u3002<br \/>\n\u6838\u5fc3\u516c\u5f0f&#xff1a;<br \/>\n\u6279\u6b21\u5355\u4ef7 &#061; \u6279\u6b21\u91d1\u989d \/ \u6279\u6b21\u6570\u91cf<br \/>\n\u53d1\u51fa\u91d1\u989d &#061; \u6263\u51cf\u6570\u91cf \u00d7 \u5bf9\u5e94\u6279\u6b21\u5355\u4ef7<br \/>\n\u671f\u672b\u7ed3\u5b58\u91d1\u989d &#061; \u5404\u5269\u4f59\u6279\u6b21\u91d1\u989d\u4e4b\u548c<br \/>\n\u671f\u672b\u7ed3\u5b58\u6570\u91cf &#061; \u5404\u5269\u4f59\u6279\u6b21\u6570\u91cf\u4e4b\u548c<\/p>\n<p>import os<br \/>\nimport pandas as pd<br \/>\nimport numpy as np<br \/>\nfrom datetime import datetime, timedelta<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u6838\u5fc3\u914d\u7f6e\u9879&#xff08;\u4e0e\u4e4b\u524d\u6d41\u6c34\u6570\u636e\u4fdd\u6301\u4e00\u81f4&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n# 1. \u6570\u636e\u76ee\u5f55&#xff08;\u5fc5\u987b\u548c\u751f\u6210\u6d41\u6c34\u7684\u76ee\u5f55\u4e00\u81f4&#xff0c;\u5426\u5219\u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6&#xff09;<br \/>\ntarget_dir &#061; r&#039;E:\\\\BI\u6a21\u578b\\\\Python\u7ec3\u4e60\u6570\u636e\\\\\u6536\u53d1\u5b58\u7ec3\u4e60&#039;<br \/>\n# 2. \u6838\u7b97\u6708\u4efd\u8303\u56f4&#xff08;\u683c\u5f0f&#xff1a;YYYYMM&#xff0c;\u5bf9\u5e94\u4e4b\u524d\u751f\u6210\u76842\u5e74\u6570\u636e&#xff0c;\u793a\u4f8b&#xff1a;202401-202512&#xff09;<br \/>\nstart_month &#061; &#039;202401&#039;<br \/>\nend_month &#061; &#039;202512&#039;<br \/>\n# 3. \u8d22\u52a1\u6570\u636e\u7cbe\u5ea6&#xff08;\u4fdd\u75592\u4f4d\u5c0f\u6570&#xff0c;\u7b26\u5408\u4f1a\u8ba1\u6838\u7b97\u8981\u6c42&#xff09;<br \/>\ndecimal_places &#061; 2<br \/>\n# &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<\/p>\n<p>def ensure_directory_exists(dir_path):<br \/>\n    &#034;&#034;&#034;\u786e\u4fdd\u76ee\u6807\u76ee\u5f55\u5b58\u5728&#xff0c;\u4e0d\u5b58\u5728\u5219\u81ea\u52a8\u521b\u5efa&#034;&#034;&#034;<br \/>\n    if not os.path.exists(dir_path):<br \/>\n        os.makedirs(dir_path, exist_ok&#061;True)<\/p>\n<p>def generate_month_list(start_month, end_month):<br \/>\n    &#034;&#034;&#034;\u751f\u6210\u8d77\u59cb\u6708\u4efd\u5230\u7ed3\u675f\u6708\u4efd\u7684\u8fde\u7eed\u6708\u4efd\u5217\u8868&#xff0c;\u7528\u4e8e\u6279\u91cf\u6eda\u52a8\u6838\u7b97&#034;&#034;&#034;<br \/>\n    # \u8f6c\u6362\u4e3a\u65e5\u671f\u5bf9\u8c61<br \/>\n    start_date &#061; datetime.strptime(start_month, &#039;%Y%m&#039;)<br \/>\n    end_date &#061; datetime.strptime(end_month, &#039;%Y%m&#039;)<br \/>\n    month_list &#061; []<\/p>\n<p>    current_date &#061; start_date<br \/>\n    while current_date &lt;&#061; end_date:<br \/>\n        month_list.append(current_date.strftime(&#039;%Y%m&#039;))<br \/>\n        # \u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u6708&#xff08;\u907f\u514d\u6708\u672b\u5929\u6570\u95ee\u9898&#xff0c;\u7528&#043;32\u5929\u518d\u53d61\u53f7&#xff09;<br \/>\n        current_date &#061; (current_date &#043; timedelta(days&#061;32)).replace(day&#061;1)<\/p>\n<p>    return month_list<\/p>\n<p>def fifo_costing_single(month_str, data_dir):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u5355\u6708\u5148\u8fdb\u5148\u51fa\u6cd5&#xff08;FIFO&#xff09;\u5355\u72ec\u6838\u7b97&#xff08;\u6838\u5fc3\u51fd\u6570&#xff09;<br \/>\n    :param month_str: \u5f85\u6838\u7b97\u6708\u4efd&#xff0c;\u683c\u5f0fYYYYMM<br \/>\n    :param data_dir: \u6d41\u6c34\u6570\u636e\u4e0e\u7ed3\u679c\u4fdd\u5b58\u76ee\u5f55<br \/>\n    :return: \u5f53\u6708FIFO\u6536\u53d1\u5b58\u6c47\u603b\u8868\u3001\u6708\u672b\u6709\u6548\u7ed3\u5b58\u8868&#xff08;\u7528\u4e8e\u4e0b\u6708\u6eda\u52a8&#xff09;<br \/>\n    &#034;&#034;&#034;<br \/>\n    # 1. \u6821\u9a8c\u5f53\u6708\u6d41\u6c34\u6587\u4ef6\u662f\u5426\u5b58\u5728<br \/>\n    monthly_flow_file &#061; os.path.join(data_dir, f&#039;\u5b58\u8d27\u6536\u53d1\u5b58\u6d41\u6c34_{month_str}.xlsx&#039;)<br \/>\n    if not os.path.exists(monthly_flow_file):<br \/>\n        raise FileNotFoundError(f&#034;\u5f53\u6708\u6536\u53d1\u5b58\u6d41\u6c34\u6587\u4ef6\u7f3a\u5931&#xff0c;\u65e0\u6cd5\u6838\u7b97&#xff1a;{monthly_flow_file}&#034;)<\/p>\n<p>    # 2. \u8bfb\u53d6\u5f53\u6708\u6d41\u6c34\u6570\u636e&#xff0c;\u6570\u636e\u6e05\u6d17\u4e0e\u9884\u5904\u7406<br \/>\n    df_flow &#061; pd.read_excel(monthly_flow_file, engine&#061;&#039;openpyxl&#039;)<br \/>\n    # \u6570\u636e\u7c7b\u578b\u8f6c\u6362\u4e0e\u7a7a\u503c\u586b\u5145&#xff08;\u907f\u514d\u8ba1\u7b97\u5f02\u5e38&#xff09;<br \/>\n    df_flow[&#039;\u5355\u636e\u65e5\u671f&#039;] &#061; pd.to_datetime(df_flow[&#039;\u5355\u636e\u65e5\u671f&#039;], errors&#061;&#039;coerce&#039;)<br \/>\n    df_flow[&#039;\u6570\u91cf&#039;] &#061; pd.to_numeric(df_flow[&#039;\u6570\u91cf&#039;], errors&#061;&#039;coerce&#039;).fillna(0)<br \/>\n    df_flow[&#039;\u91d1\u989d&#039;] &#061; pd.to_numeric(df_flow[&#039;\u91d1\u989d&#039;], errors&#061;&#039;coerce&#039;).fillna(0)<br \/>\n    # \u786e\u4fdd\u6838\u5fc3\u5173\u952e\u5b57\u6bb5\u975e\u7a7a&#xff0c;\u5220\u9664\u65e0\u6548\u8bb0\u5f55<br \/>\n    df_flow &#061; df_flow.dropna(subset&#061;[&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;, &#039;\u6279\u6b21\u53f7&#039;, &#039;\u5355\u636e\u65e5\u671f&#039;]).reset_index(drop&#061;True)<br \/>\n    # \u6309\u7269\u6599\u3001\u4ed3\u5e93\u3001\u5355\u636e\u65e5\u671f\u6392\u5e8f&#xff08;\u4fdd\u8bc1\u5165\u5e93\u987a\u5e8f\u6b63\u786e&#xff0c;FIFO\u6838\u5fc3\u524d\u63d0&#xff09;<br \/>\n    df_flow &#061; df_flow.sort_values(by&#061;[&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;, &#039;\u5355\u636e\u65e5\u671f&#039;, &#039;\u6279\u6b21\u53f7&#039;]).reset_index(drop&#061;True)<\/p>\n<p>    # 3. \u8bfb\u53d6\u4e0a\u6708FIFO\u7ed3\u5b58\u6570\u636e&#xff08;\u5b9e\u73b0\u6708\u5ea6\u6eda\u52a8&#xff1a;\u4e0a\u6708\u671f\u672b &#061; \u672c\u6708\u671f\u521d&#xff09;<br \/>\n    last_month_date &#061; datetime.strptime(month_str, &#039;%Y%m&#039;) &#8211; timedelta(days&#061;1)<br \/>\n    last_month_str &#061; last_month_date.strftime(&#039;%Y%m&#039;)<br \/>\n    last_month_balance_file &#061; os.path.join(data_dir, f&#039;FIFO_\u5b58\u8d27\u7ed3\u5b58_{last_month_str}.xlsx&#039;)<\/p>\n<p>    if os.path.exists(last_month_balance_file):<br \/>\n        # \u4e0a\u6708\u6709\u7ed3\u5b58\u6570\u636e&#xff0c;\u8bfb\u53d6\u5e76\u4f5c\u4e3a\u672c\u6708\u671f\u521d\u6279\u6b21<br \/>\n        df_begin_balance &#061; pd.read_excel(last_month_balance_file, engine&#061;&#039;openpyxl&#039;)<br \/>\n        # \u6570\u636e\u7c7b\u578b\u6821\u9a8c<br \/>\n        df_begin_balance[&#039;\u7ed3\u5b58\u6570\u91cf&#039;] &#061; pd.to_numeric(df_begin_balance[&#039;\u7ed3\u5b58\u6570\u91cf&#039;], errors&#061;&#039;coerce&#039;).fillna(0)<br \/>\n        df_begin_balance[&#039;\u7ed3\u5b58\u91d1\u989d&#039;] &#061; pd.to_numeric(df_begin_balance[&#039;\u7ed3\u5b58\u91d1\u989d&#039;], errors&#061;&#039;coerce&#039;).fillna(0)<br \/>\n        df_begin_balance[&#039;\u7ed3\u5b58\u5355\u4ef7&#039;] &#061; pd.to_numeric(df_begin_balance[&#039;\u7ed3\u5b58\u5355\u4ef7&#039;], errors&#061;&#039;coerce&#039;).fillna(0)<br \/>\n    else:<br \/>\n        # \u9996\u6b21\u6838\u7b97&#xff08;\u65e0\u4e0a\u6708\u7ed3\u5b58&#xff09;&#xff0c;\u521d\u59cb\u5316\u671f\u521d\u7ed3\u5b58\u4e3a\u7a7a\u8868<br \/>\n        df_begin_balance &#061; pd.DataFrame(<br \/>\n            columns&#061;[&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;, &#039;\u6279\u6b21\u53f7&#039;, &#039;\u7ed3\u5b58\u6570\u91cf&#039;, &#039;\u7ed3\u5b58\u91d1\u989d&#039;, &#039;\u7ed3\u5b58\u5355\u4ef7&#039;]<br \/>\n        )<\/p>\n<p>    # 4. \u6309\u300c\u7269\u6599\u7f16\u7801&#043;\u4ed3\u5e93\u7f16\u7801\u300d\u5206\u7ec4&#xff0c;\u9010\u7ec4\u6267\u884cFIFO\u6838\u5fc3\u6838\u7b97<br \/>\n    summary_result_list &#061; []  # \u5b58\u50a8\u5404\u7ec4\u6536\u53d1\u5b58\u6c47\u603b\u7ed3\u679c<br \/>\n    end_balance_list &#061; []     # \u5b58\u50a8\u5404\u7ec4\u6708\u672b\u6709\u6548\u7ed3\u5b58<\/p>\n<p>    for (material, warehouse), group_df in df_flow.groupby([&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;]):<br \/>\n        # 4.1 \u63d0\u53d6\u8be5\u7269\u6599-\u4ed3\u5e93\u7684\u671f\u521d\u7ed3\u5b58\u6279\u6b21&#xff0c;\u6309\u6279\u6b21\u53f7\u6392\u5e8f&#xff08;\u4fdd\u6301\u5165\u5e93\u5148\u540e\u987a\u5e8f&#xff09;<br \/>\n        group_begin_balance &#061; df_begin_balance[<br \/>\n            (df_begin_balance[&#039;\u7269\u6599\u7f16\u7801&#039;] &#061;&#061; material) &amp;<br \/>\n            (df_begin_balance[&#039;\u4ed3\u5e93\u7f16\u7801&#039;] &#061;&#061; warehouse)<br \/>\n        ].sort_values(by&#061;&#039;\u6279\u6b21\u53f7&#039;).reset_index(drop&#061;True)<\/p>\n<p>        # 4.2 \u521d\u59cb\u5316\u5f53\u524d\u7ed3\u5b58&#xff08;\u671f\u521d\u6279\u6b21\u4f5c\u4e3a\u521d\u59cb\u53ef\u7528\u5e93\u5b58&#xff09;<br \/>\n        current_balance &#061; group_begin_balance.copy() if not group_begin_balance.empty else pd.DataFrame(<br \/>\n            columns&#061;[&#039;\u6279\u6b21\u53f7&#039;, &#039;\u7ed3\u5b58\u6570\u91cf&#039;, &#039;\u7ed3\u5b58\u91d1\u989d&#039;, &#039;\u7ed3\u5b58\u5355\u4ef7&#039;]<br \/>\n        )<\/p>\n<p>        # 4.3 \u62c6\u5206\u5f53\u6708\u6536\u53d1\u8bb0\u5f55&#xff08;\u5165\u5e93&#061;\u6b63\u6570&#xff0c;\u51fa\u5e93&#061;\u8d1f\u6570&#xff09;<br \/>\n        in_df &#061; group_df[group_df[&#039;\u6570\u91cf&#039;] &gt; 0].reset_index(drop&#061;True)  # \u5165\u5e93\u8bb0\u5f55<br \/>\n        out_df &#061; group_df[group_df[&#039;\u6570\u91cf&#039;] &lt; 0].reset_index(drop&#061;True) # \u51fa\u5e93\u8bb0\u5f55<\/p>\n<p>        # 4.4 \u5904\u7406\u5165\u5e93&#xff1a;\u76f4\u63a5\u8ffd\u52a0\u6279\u6b21\u5230\u5f53\u524d\u7ed3\u5b58&#xff0c;\u8ba1\u7b97\u6279\u6b21\u5355\u4ef7<br \/>\n        for _, in_row in in_df.iterrows():<br \/>\n            batch_quantity &#061; in_row[&#039;\u6570\u91cf&#039;]<br \/>\n            batch_amount &#061; in_row[&#039;\u91d1\u989d&#039;]<br \/>\n            batch_price &#061; np.round(batch_amount \/ batch_quantity, decimal_places) if batch_quantity &gt; 0 else 0.0<\/p>\n<p>            # \u6784\u9020\u65b0\u6279\u6b21\u8bb0\u5f55<br \/>\n            new_batch &#061; pd.DataFrame({<br \/>\n                &#039;\u6279\u6b21\u53f7&#039;: [in_row[&#039;\u6279\u6b21\u53f7&#039;]],<br \/>\n                &#039;\u7ed3\u5b58\u6570\u91cf&#039;: [batch_quantity],<br \/>\n                &#039;\u7ed3\u5b58\u91d1\u989d&#039;: [batch_amount],<br \/>\n                &#039;\u7ed3\u5b58\u5355\u4ef7&#039;: [batch_price]<br \/>\n            })<\/p>\n<p>            # \u8ffd\u52a0\u5230\u5f53\u524d\u7ed3\u5b58&#xff0c;\u4fdd\u6301\u987a\u5e8f<br \/>\n            current_balance &#061; pd.concat([current_balance, new_batch], ignore_index&#061;True)<\/p>\n<p>        # 4.5 \u5904\u7406\u51fa\u5e93&#xff1a;\u6309\u5148\u8fdb\u5148\u51fa\u987a\u5e8f\u9010\u6279\u6263\u51cf&#xff0c;\u6838\u5fc3FIFO\u903b\u8f91<br \/>\n        for _, out_row in out_df.iterrows():<br \/>\n            out_quantity_need &#061; abs(out_row[&#039;\u6570\u91cf&#039;])  # \u9700\u51fa\u5e93\u7684\u603b\u6570\u91cf&#xff08;\u8f6c\u4e3a\u6b63\u6570&#xff09;<br \/>\n            remaining_out &#061; out_quantity_need  # \u5269\u4f59\u672a\u6263\u51cf\u7684\u51fa\u5e93\u6570\u91cf<\/p>\n<p>            # \u9010\u6279\u6263\u51cf&#xff0c;\u76f4\u81f3\u5269\u4f59\u51fa\u5e93\u6570\u91cf\u4e3a0\u6216\u7ed3\u5b58\u4e3a\u7a7a<br \/>\n            if not current_balance.empty:<br \/>\n                for idx, balance_row in current_balance.iterrows():<br \/>\n                    if remaining_out &lt;&#061; 0:<br \/>\n                        break<\/p>\n<p>                    batch_available &#061; balance_row[&#039;\u7ed3\u5b58\u6570\u91cf&#039;]<br \/>\n                    batch_price &#061; balance_row[&#039;\u7ed3\u5b58\u5355\u4ef7&#039;]<\/p>\n<p>                    if batch_available &gt; remaining_out:<br \/>\n                        # \u60c5\u51b51&#xff1a;\u5f53\u524d\u6279\u6b21\u6570\u91cf\u8db3\u591f&#xff0c;\u6263\u51cf\u90e8\u5206\u6570\u91cf\u548c\u91d1\u989d<br \/>\n                        current_balance.loc[idx, &#039;\u7ed3\u5b58\u6570\u91cf&#039;] &#061; np.round(<br \/>\n                            batch_available &#8211; remaining_out, decimal_places<br \/>\n                        )<br \/>\n                        current_balance.loc[idx, &#039;\u7ed3\u5b58\u91d1\u989d&#039;] &#061; np.round(<br \/>\n                            current_balance.loc[idx, &#039;\u7ed3\u5b58\u6570\u91cf&#039;] * batch_price, decimal_places<br \/>\n                        )<br \/>\n                        remaining_out &#061; 0<br \/>\n                    else:<br \/>\n                        # \u60c5\u51b52&#xff1a;\u5f53\u524d\u6279\u6b21\u6570\u91cf\u4e0d\u8db3&#xff0c;\u5168\u989d\u6263\u51cf&#xff0c;\u5220\u9664\u8be5\u6279\u6b21<br \/>\n                        remaining_out -&#061; batch_available<br \/>\n                        current_balance.drop(idx, inplace&#061;True)<\/p>\n<p>                # \u91cd\u7f6e\u7d22\u5f15&#xff0c;\u907f\u514d\u540e\u7eed\u8fed\u4ee3\u5f02\u5e38<br \/>\n                current_balance &#061; current_balance.reset_index(drop&#061;True)<\/p>\n<p>        # 4.6 \u6c47\u603b\u8be5\u7269\u6599-\u4ed3\u5e93\u7684\u6536\u53d1\u5b58\u6570\u636e<br \/>\n        # \u671f\u521d\u6570\u636e\u6c47\u603b<br \/>\n        begin_quantity &#061; np.round(group_begin_balance[&#039;\u7ed3\u5b58\u6570\u91cf&#039;].sum(), decimal_places)<br \/>\n        begin_amount &#061; np.round(group_begin_balance[&#039;\u7ed3\u5b58\u91d1\u989d&#039;].sum(), decimal_places)<br \/>\n        # \u5f53\u6708\u6536\u53d1\u6570\u636e\u6c47\u603b<br \/>\n        total_in_quantity &#061; np.round(in_df[&#039;\u6570\u91cf&#039;].sum(), decimal_places) if not in_df.empty else 0.0<br \/>\n        total_in_amount &#061; np.round(in_df[&#039;\u91d1\u989d&#039;].sum(), decimal_places) if not in_df.empty else 0.0<br \/>\n        total_out_quantity &#061; np.round(abs(out_df[&#039;\u6570\u91cf&#039;].sum()), decimal_places) if not out_df.empty else 0.0<br \/>\n        # \u53d1\u51fa\u91d1\u989d&#xff1a;\u901a\u8fc7FIFO\u6263\u51cf\u8ba1\u7b97&#xff08;\u671f\u521d&#043;\u5165\u5e93-\u671f\u672b&#xff0c;\u907f\u514d\u76f4\u63a5\u6c42\u548c\u8bef\u5dee&#xff09;<br \/>\n        end_quantity &#061; np.round(current_balance[&#039;\u7ed3\u5b58\u6570\u91cf&#039;].sum(), decimal_places)<br \/>\n        end_amount &#061; np.round(current_balance[&#039;\u7ed3\u5b58\u91d1\u989d&#039;].sum(), decimal_places)<br \/>\n        total_out_amount &#061; np.round(begin_amount &#043; total_in_amount &#8211; end_amount, decimal_places)<\/p>\n<p>        # 4.7 \u5b58\u5165\u6c47\u603b\u7ed3\u679c\u5217\u8868<br \/>\n        summary_result_list.append({<br \/>\n            &#039;\u7269\u6599\u7f16\u7801&#039;: material,<br \/>\n            &#039;\u4ed3\u5e93\u7f16\u7801&#039;: warehouse,<br \/>\n            &#039;\u671f\u521d\u6570\u91cf&#039;: begin_quantity,<br \/>\n            &#039;\u671f\u521d\u91d1\u989d&#039;: begin_amount,<br \/>\n            &#039;\u672c\u6708\u6536\u5165\u6570\u91cf&#039;: total_in_quantity,<br \/>\n            &#039;\u672c\u6708\u6536\u5165\u91d1\u989d&#039;: total_in_amount,<br \/>\n            &#039;\u672c\u6708\u53d1\u51fa\u6570\u91cf&#039;: total_out_quantity,<br \/>\n            &#039;\u672c\u6708\u53d1\u51fa\u91d1\u989d&#039;: total_out_amount,<br \/>\n            &#039;\u671f\u672b\u6570\u91cf&#039;: end_quantity,<br \/>\n            &#039;\u671f\u672b\u91d1\u989d&#039;: end_amount<br \/>\n        })<\/p>\n<p>        # 4.8 \u5b58\u5165\u6708\u672b\u7ed3\u5b58\u5217\u8868&#xff08;\u7528\u4e8e\u4e0b\u6708\u6eda\u52a8&#xff0c;\u6dfb\u52a0\u7269\u6599\/\u4ed3\u5e93\u6807\u8bc6&#xff09;<br \/>\n        if not current_balance.empty:<br \/>\n            current_balance[&#039;\u7269\u6599\u7f16\u7801&#039;] &#061; material<br \/>\n            current_balance[&#039;\u4ed3\u5e93\u7f16\u7801&#039;] &#061; warehouse<br \/>\n            end_balance_list.append(current_balance)<\/p>\n<p>    # 5. \u6574\u7406\u6700\u7ec8\u6838\u7b97\u7ed3\u679c<br \/>\n    # 5.1 \u5b8c\u6574\u6536\u53d1\u5b58\u6c47\u603b\u8868<br \/>\n    df_final_summary &#061; pd.DataFrame(summary_result_list).reset_index(drop&#061;True)<br \/>\n    # 5.2 \u6708\u672b\u6709\u6548\u7ed3\u5b58\u8868&#xff08;\u4ec5\u4fdd\u7559\u6709\u7ed3\u5b58\u7684\u6279\u6b21&#xff0c;\u7528\u4e8e\u4e0b\u6708\u671f\u521d&#xff09;<br \/>\n    if end_balance_list:<br \/>\n        df_end_balance_valid &#061; pd.concat(end_balance_list, ignore_index&#061;True)<br \/>\n        # \u7b5b\u9009\u6709\u6548\u7ed3\u5b58&#xff08;\u6570\u91cf&gt;0&#xff09;&#xff0c;\u53bb\u9664\u5197\u4f59<br \/>\n        df_end_balance_valid &#061; df_end_balance_valid[df_end_balance_valid[&#039;\u7ed3\u5b58\u6570\u91cf&#039;] &gt; 0].reset_index(drop&#061;True)<br \/>\n        # \u8c03\u6574\u5217\u987a\u5e8f&#xff0c;\u4fbf\u4e8e\u9605\u8bfb<br \/>\n        df_end_balance_valid &#061; df_end_balance_valid[[&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;, &#039;\u6279\u6b21\u53f7&#039;, &#039;\u7ed3\u5b58\u6570\u91cf&#039;, &#039;\u7ed3\u5b58\u91d1\u989d&#039;, &#039;\u7ed3\u5b58\u5355\u4ef7&#039;]]<br \/>\n    else:<br \/>\n        df_end_balance_valid &#061; pd.DataFrame(<br \/>\n            columns&#061;[&#039;\u7269\u6599\u7f16\u7801&#039;, &#039;\u4ed3\u5e93\u7f16\u7801&#039;, &#039;\u6279\u6b21\u53f7&#039;, &#039;\u7ed3\u5b58\u6570\u91cf&#039;, &#039;\u7ed3\u5b58\u91d1\u989d&#039;, &#039;\u7ed3\u5b58\u5355\u4ef7&#039;]<br \/>\n        )<\/p>\n<p>    # 6. \u4fdd\u5b58\u6838\u7b97\u7ed3\u679c\u5230Excel&#xff08;\u6309\u6708\u4efd\u547d\u540d&#xff0c;\u4fbf\u4e8e\u8ffd\u6eaf\u548c\u6eda\u52a8&#xff09;<br \/>\n    summary_save_path &#061; os.path.join(data_dir, f&#039;FIFO_\u6536\u53d1\u5b58\u6c47\u603b_{month_str}.xlsx&#039;)<br \/>\n    balance_save_path &#061; os.path.join(data_dir, f&#039;FIFO_\u5b58\u8d27\u7ed3\u5b58_{month_str}.xlsx&#039;)<\/p>\n<p>    df_final_summary.to_excel(summary_save_path, index&#061;False, engine&#061;&#039;openpyxl&#039;)<br \/>\n    df_end_balance_valid.to_excel(balance_save_path, index&#061;False, engine&#061;&#039;openpyxl&#039;)<\/p>\n<p>    # 7. \u6253\u5370\u6838\u7b97\u5b8c\u6210\u65e5\u5fd7<br \/>\n    print(f&#034;\u2705 {month_str} \u5148\u8fdb\u5148\u51fa\u6cd5&#xff08;FIFO&#xff09;\u6838\u7b97\u5b8c\u6210&#034;)<br \/>\n    print(f&#034;   \u5b8c\u6574\u6c47\u603b\u8868\u4fdd\u5b58\u8def\u5f84&#xff1a;{summary_save_path}&#034;)<br \/>\n    print(f&#034;   \u6708\u672b\u7ed3\u5b58\u8868&#xff08;\u4e0b\u6708\u671f\u521d&#xff09;\u4fdd\u5b58\u8def\u5f84&#xff1a;{balance_save_path}&#034;)<\/p>\n<p>    return df_final_summary, df_end_balance_valid<\/p>\n<p>def batch_monthly_rolling_fifo_costing(data_dir, start_month, end_month):<br \/>\n    &#034;&#034;&#034;<br \/>\n    \u6279\u91cf\u6267\u884c\u5148\u8fdb\u5148\u51fa\u6cd5\u6708\u5ea6\u6eda\u52a8\u6838\u7b97&#xff08;\u904d\u5386\u6307\u5b9a\u6708\u4efd\u8303\u56f4&#xff0c;\u81ea\u52a8\u627f\u63a5\u4e0a\u6708\u7ed3\u5b58&#xff09;<br \/>\n    &#034;&#034;&#034;<br \/>\n    # \u786e\u4fdd\u76ee\u5f55\u5b58\u5728<br \/>\n    ensure_directory_exists(data_dir)<br \/>\n    # \u751f\u6210\u5f85\u6838\u7b97\u6708\u4efd\u5217\u8868<br \/>\n    month_calc_list &#061; generate_month_list(start_month, end_month)<\/p>\n<p>    # \u9010\u6708\u7d2f\u52a0\u6838\u7b97<br \/>\n    for month in month_calc_list:<br \/>\n        try:<br \/>\n            fifo_costing_single(month, data_dir)<br \/>\n        except Exception as e:<br \/>\n            print(f&#034;\u274c {month} \u5148\u8fdb\u5148\u51fa\u6cd5&#xff08;FIFO&#xff09;\u6838\u7b97\u5931\u8d25&#xff0c;\u9519\u8bef\u4fe1\u606f&#xff1a;{str(e)}&#034;)<br \/>\n            continue<\/p>\n<p># &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u6267\u884c\u5148\u8fdb\u5148\u51fa\u6cd5\u6279\u91cf\u6eda\u52a8\u6838\u7b97 &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\nif __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    batch_monthly_rolling_fifo_costing(target_dir, start_month, end_month)<\/p>\n<h3 id=\"%E5%85%B3%E9%94%AE%E8%AF%B4%E6%98%8E\">\u5173\u952e\u8bf4\u660e<\/h3>\n<h4 id=\"1.%20%E9%85%8D%E7%BD%AE%E9%A1%B9%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9\">1. \u914d\u7f6e\u9879\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>target_dir&#xff1a;\u5fc5\u987b\u4e0e\u4e4b\u524d\u751f\u6210\u6d41\u6c34\u6570\u636e\u7684\u76ee\u5f55\u5b8c\u5168\u4e00\u81f4&#xff0c;\u5426\u5219\u4f1a\u63d0\u793a\u6d41\u6c34\u6587\u4ef6\u7f3a\u5931&#xff0c;\u65e0\u6cd5\u8fdb\u884c\u6838\u7b97\u3002<\/li>\n<li>start_month\/end_month&#xff1a;\u9700\u5bf9\u5e94\u4e4b\u524d\u751f\u6210\u7684 2 \u5e74\u6d41\u6c34\u6570\u636e\u6708\u4efd&#xff08;\u4f8b\u5982 202401-202512&#xff09;&#xff0c;\u76f4\u63a5\u590d\u7528\u5373\u53ef\u5b9e\u73b0\u5168\u5468\u671f\u6eda\u52a8\u3002<\/li>\n<li>decimal_places&#xff1a;\u56fa\u5b9a\u4e3a 2 \u4f4d\u5c0f\u6570&#xff0c;\u7b26\u5408\u8d22\u52a1\u6838\u7b97\u7684\u91d1\u989d\u7cbe\u5ea6\u8981\u6c42&#xff0c;\u89c4\u907f\u6d6e\u70b9\u8fd0\u7b97\u5e26\u6765\u7684\u5c3e\u5dee\u95ee\u9898\u3002<\/li>\n<\/ul>\n<h4 id=\"2.%20FIFO%20%E6%A0%B8%E5%BF%83%E5%AE%9E%E7%8E%B0%E8%A6%81%E7%82%B9\">2. FIFO \u6838\u5fc3\u5b9e\u73b0\u8981\u70b9<\/h4>\n<ul>\n<li>\u6392\u5e8f\u524d\u63d0&#xff1a;\u6d41\u6c34\u6570\u636e\u5148\u6309\u300c\u7269\u6599\u7f16\u7801\u2192\u4ed3\u5e93\u7f16\u7801\u2192\u5355\u636e\u65e5\u671f\u2192\u6279\u6b21\u53f7\u300d\u6392\u5e8f&#xff0c;\u4fdd\u8bc1\u5165\u5e93\u6279\u6b21\u7684\u65f6\u95f4\u987a\u5e8f\u6b63\u786e&#xff0c;\u8fd9\u662f FIFO \u6838\u7b97\u7684\u57fa\u7840\u3002<\/li>\n<li>\u9010\u6279\u6263\u51cf&#xff1a;\u51fa\u5e93\u65f6\u904d\u5386\u5f53\u524d\u7ed3\u5b58\u6279\u6b21&#xff0c;\u4f18\u5148\u6263\u51cf\u6700\u65e9\u5165\u5e93\u6279\u6b21&#xff0c;\u5206\u300c\u6279\u6b21\u8db3\u591f\u6263\u51cf\u300d\u548c\u300c\u6279\u6b21\u4e0d\u8db3\u6263\u51cf\u300d\u4e24\u79cd\u573a\u666f\u5904\u7406&#xff0c;\u786e\u4fdd\u903b\u8f91\u4e25\u8c28\u3002<\/li>\n<li>\u91d1\u989d\u52fe\u7a3d&#xff1a;\u672c\u6708\u53d1\u51fa\u91d1\u989d\u901a\u8fc7\u300c\u671f\u521d\u91d1\u989d &#043; \u672c\u6708\u6536\u5165\u91d1\u989d &#8211; \u671f\u672b\u91d1\u989d\u300d\u5012\u7b97&#xff0c;\u907f\u514d\u76f4\u63a5\u7d2f\u52a0\u6263\u51cf\u91d1\u989d\u5e26\u6765\u7684\u7cbe\u5ea6\u8bef\u5dee&#xff0c;\u4fdd\u8bc1\u6570\u636e\u52fe\u7a3d\u5173\u7cfb\u6b63\u786e\u3002<\/li>\n<\/ul>\n<h4 id=\"3.%20%E6%9C%88%E5%BA%A6%E6%BB%9A%E5%8A%A8%E7%9A%84%E5%AE%9E%E7%8E%B0%E6%A0%B8%E5%BF%83\">3. \u6708\u5ea6\u6eda\u52a8\u7684\u5b9e\u73b0\u6838\u5fc3<\/h4>\n<ul>\n<li>\u6bcf\u6708\u6838\u7b97\u5b8c\u6210\u540e&#xff0c;\u751f\u6210\u300cFIFO_\u5b58\u8d27\u7ed3\u5b58_YYYYMM.xlsx\u300d&#xff0c;\u8bb0\u5f55\u5269\u4f59\u6709\u6548\u6279\u6b21\u7684\u300c\u7269\u6599 &#043; \u4ed3\u5e93 &#043; \u6279\u6b21 &#043; \u6570\u91cf &#043; \u91d1\u989d &#043; \u5355\u4ef7\u300d\u3002<\/li>\n<li>\u4e0b\u6708\u6838\u7b97\u65f6&#xff0c;\u81ea\u52a8\u8bfb\u53d6\u4e0a\u6708\u7ed3\u5b58\u6587\u4ef6&#xff0c;\u5c06\u8be5\u6279\u6b21\u6570\u636e\u4f5c\u4e3a\u671f\u521d\u53ef\u7528\u5e93\u5b58&#xff0c;\u4fdd\u6301\u6279\u6b21\u7684\u65f6\u95f4\u987a\u5e8f&#xff0c;\u5b9e\u73b0\u6570\u636e\u7684\u8fde\u7eed\u627f\u63a5\u3002<\/li>\n<li>\u9996\u6b21\u6838\u7b97\u65e0\u4e0a\u6708\u7ed3\u5b58\u65f6&#xff0c;\u81ea\u52a8\u521d\u59cb\u5316\u7a7a\u7ed3\u5b58\u8868&#xff0c;\u4e0d\u5f71\u54cd\u6838\u7b97\u6d41\u7a0b&#xff0c;\u786e\u4fdd\u9996\u6b21\u8fd0\u884c\u5373\u53ef\u6b63\u5e38\u4ea7\u51fa\u7ed3\u679c\u3002<\/li>\n<\/ul>\n<h4 id=\"4.%20%E6%96%87%E4%BB%B6%E5%91%BD%E5%90%8D%E8%A7%84%E5%88%99%EF%BC%88%E6%B8%85%E6%99%B0%E5%8F%AF%E8%BF%BD%E6%BA%AF%EF%BC%89\">4. \u6587\u4ef6\u547d\u540d\u89c4\u5219&#xff08;\u6e05\u6670\u53ef\u8ffd\u6eaf&#xff09;<\/h4>\n<table>\n<tr>\u6587\u4ef6\u7c7b\u578b\u6587\u4ef6\u540d\u683c\u5f0f\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>\u6536\u53d1\u5b58\u6c47\u603b\u8868<\/td>\n<td>FIFO_\u6536\u53d1\u5b58\u6c47\u603b_YYYYMM.xlsx<\/td>\n<td>\u6309\u300c\u7269\u6599 &#043; \u4ed3\u5e93\u300d\u5c55\u793a\u8be5\u6708\u671f\u521d\u3001\u6536\u53d1\u3001\u671f\u672b\u6570\u636e&#xff0c;\u7528\u4e8e\u5bf9\u8d26\u548c\u62a5\u8868\u751f\u6210<\/td>\n<\/tr>\n<tr>\n<td>\u6708\u672b\u7ed3\u5b58\u8868<\/td>\n<td>FIFO_\u5b58\u8d27\u7ed3\u5b58_YYYYMM.xlsx<\/td>\n<td>\u6309\u300c\u7269\u6599 &#043; \u4ed3\u5e93 &#043; \u6279\u6b21\u300d\u5c55\u793a\u6708\u672b\u6709\u6548\u7ed3\u5b58&#xff0c;\u4f5c\u4e3a\u4e0b\u6708\u671f\u521d\u6570\u636e&#xff0c;\u652f\u6491\u6eda\u52a8\u8ba1\u7b97<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"5.%20%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86%E4%B8%8E%E6%95%B0%E6%8D%AE%E5%85%BC%E5%AE%B9\">5. \u5f02\u5e38\u5904\u7406\u4e0e\u6570\u636e\u517c\u5bb9<\/h4>\n<ul>\n<li>\u82e5\u67d0\u6708\u4efd\u6d41\u6c34\u6587\u4ef6\u7f3a\u5931&#xff0c;\u4f1a\u6253\u5370\u9519\u8bef\u4fe1\u606f\u5e76\u8df3\u8fc7\u8be5\u6708&#xff0c;\u4e0d\u5f71\u54cd\u5176\u4ed6\u6708\u4efd\u7684\u6b63\u5e38\u6838\u7b97\u3002<\/li>\n<li>\u81ea\u52a8\u6e05\u6d17\u6d41\u6c34\u6570\u636e&#xff1a;\u8f6c\u6362\u65e5\u671f\u7c7b\u578b\u3001\u586b\u5145\u6570\u503c\u7a7a\u503c\u3001\u5220\u9664\u6838\u5fc3\u5b57\u6bb5\u65e0\u6548\u8bb0\u5f55&#xff0c;\u907f\u514d\u6838\u7b97\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u62a5\u9519\u3002<\/li>\n<li>\u517c\u5bb9\u6d41\u6c34\u6570\u636e\u7684\u6b63\u8d1f\u503c\u683c\u5f0f&#xff1a;\u5165\u5e93\u4e3a\u6b63\u3001\u51fa\u5e93\u4e3a\u8d1f&#xff0c;\u62c6\u5206\u6536\u53d1\u8bb0\u5f55\u65f6\u76f4\u63a5\u6309\u6570\u503c\u7b26\u53f7\u7b5b\u9009&#xff0c;\u65e0\u9700\u989d\u5916\u8f6c\u6362\u3002<\/li>\n<\/ul>\n<h3 id=\"%E8%BF%90%E8%A1%8C%E6%AD%A5%E9%AA%A4\">\u8fd0\u884c\u6b65\u9aa4<\/h3>\n<li>\u786e\u4fdd\u4e4b\u524d\u751f\u6210\u7684\u300c\u5b58\u8d27\u6536\u53d1\u5b58\u6d41\u6c34_YYYYMM.xlsx\u300d\u5df2\u5b8c\u6574\u4fdd\u5b58\u5728\u6307\u5b9a\u76ee\u6807\u76ee\u5f55\u3002<\/li>\n<li>&#xff08;\u53ef\u9009&#xff09;\u8c03\u6574start_month\u548cend_month\u4e3a\u9700\u8981\u6838\u7b97\u7684\u5177\u4f53\u6708\u4efd\u8303\u56f4&#xff08;\u9ed8\u8ba4\u8986\u76d6 2 \u5e74\u6570\u636e&#xff09;\u3002<\/li>\n<li>\u786e\u4fdd\u5df2\u5b89\u88c5\u4f9d\u8d56\u5e93&#xff08;pandas\u3001openpyxl&#xff09;&#xff0c;\u76f4\u63a5\u8fd0\u884c\u8be5\u811a\u672c\u3002<\/li>\n<li>\u8fd0\u884c\u5b8c\u6210\u540e&#xff0c;\u5728\u76ee\u6807\u76ee\u5f55\u67e5\u770b\u6bcf\u4e2a\u6708\u4efd\u5bf9\u5e94\u7684 2 \u4e2a FIFO \u6838\u7b97\u7ed3\u679c\u6587\u4ef6\u3002<\/li>\n<h3 id=\"%E8%BE%93%E5%87%BA%E7%BB%93%E6%9E%9C%E8%AF%B4%E6%98%8E\">\u8f93\u51fa\u7ed3\u679c\u8bf4\u660e<\/h3>\n<ul>\n<li>\u6bcf\u4e2a\u6708\u4efd\u751f\u6210 2 \u4e2a Excel \u6587\u4ef6&#xff0c;\u6570\u636e\u65e0\u5197\u4f59&#xff0c;\u7b26\u5408\u8d22\u52a1\u5bf9\u8d26\u548c\u7cfb\u7edf\u5bf9\u63a5\u7684\u8981\u6c42\u3002<\/li>\n<li>\u6c47\u603b\u8868\u5c55\u793a\u5b8c\u6574\u7684\u6536\u53d1\u5b58\u52fe\u7a3d\u5173\u7cfb&#xff0c;\u53ef\u76f4\u63a5\u7528\u4e8e\u8d22\u52a1\u62a5\u8868\u7f16\u5236&#xff1b;\u7ed3\u5b58\u8868\u4fdd\u7559\u6279\u6b21\u660e\u7ec6&#xff0c;\u4e3a\u4e0b\u6708\u6eda\u52a8\u6838\u7b97\u63d0\u4f9b\u51c6\u786e\u671f\u521d\u6570\u636e\u3002<\/li>\n<li>\u6240\u6709\u91d1\u989d\u3001\u6570\u91cf\u3001\u5355\u4ef7\u5747\u4fdd\u7559 2 \u4f4d\u5c0f\u6570&#xff0c;\u7b26\u5408\u4f1a\u8ba1\u6838\u7b97\u51c6\u5219&#xff0c;\u65e0\u7cbe\u5ea6\u8bef\u5dee&#xff0c;\u53ef\u76f4\u63a5\u7528\u4e8e\u6b63\u5f0f\u8d22\u52a1\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u751f\u6210\u6d4b\u8bd5 Excel \u6570\u636e&#xff08;\u4e24\u5e74\u6570\u636e&#xff0c;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff09;\u6838\u5fc3\u601d\u8def\u751f\u6210\u65f6\u95f4\u8303\u56f4&#xff1a;2 \u5e74&#xff08;24 \u4e2a\u6708&#xff09;&#xff0c;\u6309\u81ea\u7136\u6708\u5212\u5206\u5b58\u8d27\u5c5e\u6027&#xff1a;\u6309\u6279\u6b21\u7ba1\u7406&#xff0c;\u5305\u542b\u7269\u6599\u7f16\u7801\u3001\u6279\u6b21\u53f7\u3001\u4ed3\u5e93\u7f16\u7801\u7b49\u6838\u5fc3\u5b57\u6bb5\u4e1a\u52a1\u7c7b\u578b&#xff1a;\u8986\u76d6\u91c7\u8d2d\u5165\u5e93\u3001\u9500\u552e\u51fa\u5e93\u3001\u54c1\u79cd\u8c03\u6574\u51fa\u5165\u5e93\u3001\u8c03\u62e8\u51fa\u5165\u5e93\u3001\u76d8\u4e8f\u76d8\u76c8\u6570\u636e\u91cf&#xff1a;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff0c;24 \u4e2a\u6708\u603b\u8ba1\u7ea6 120 \u4e07\u884c&amp;#xf<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,4278,81,87],"topic":[],"class_list":["post-63303","post","type-post","status-publish","format-standard","hentry","category-server","tag-java","tag-pandas","tag-python","tag-87"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/63303.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u751f\u6210\u6d4b\u8bd5 Excel \u6570\u636e&#xff08;\u4e24\u5e74\u6570\u636e&#xff0c;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff09;\u6838\u5fc3\u601d\u8def\u751f\u6210\u65f6\u95f4\u8303\u56f4&#xff1a;2 \u5e74&#xff08;24 \u4e2a\u6708&#xff09;&#xff0c;\u6309\u81ea\u7136\u6708\u5212\u5206\u5b58\u8d27\u5c5e\u6027&#xff1a;\u6309\u6279\u6b21\u7ba1\u7406&#xff0c;\u5305\u542b\u7269\u6599\u7f16\u7801\u3001\u6279\u6b21\u53f7\u3001\u4ed3\u5e93\u7f16\u7801\u7b49\u6838\u5fc3\u5b57\u6bb5\u4e1a\u52a1\u7c7b\u578b&#xff1a;\u8986\u76d6\u91c7\u8d2d\u5165\u5e93\u3001\u9500\u552e\u51fa\u5e93\u3001\u54c1\u79cd\u8c03\u6574\u51fa\u5165\u5e93\u3001\u8c03\u62e8\u51fa\u5165\u5e93\u3001\u76d8\u4e8f\u76d8\u76c8\u6570\u636e\u91cf&#xff1a;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff0c;24 \u4e2a\u6708\u603b\u8ba1\u7ea6 120 \u4e07\u884c&amp;#xf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/63303.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-21T12:16:46+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63303.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/63303.html\",\"name\":\"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-21T12:16:46+00:00\",\"dateModified\":\"2026-01-21T12:16:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/63303.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/63303.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63303.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/63303.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u751f\u6210\u6d4b\u8bd5 Excel \u6570\u636e&#xff08;\u4e24\u5e74\u6570\u636e&#xff0c;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff09;\u6838\u5fc3\u601d\u8def\u751f\u6210\u65f6\u95f4\u8303\u56f4&#xff1a;2 \u5e74&#xff08;24 \u4e2a\u6708&#xff09;&#xff0c;\u6309\u81ea\u7136\u6708\u5212\u5206\u5b58\u8d27\u5c5e\u6027&#xff1a;\u6309\u6279\u6b21\u7ba1\u7406&#xff0c;\u5305\u542b\u7269\u6599\u7f16\u7801\u3001\u6279\u6b21\u53f7\u3001\u4ed3\u5e93\u7f16\u7801\u7b49\u6838\u5fc3\u5b57\u6bb5\u4e1a\u52a1\u7c7b\u578b&#xff1a;\u8986\u76d6\u91c7\u8d2d\u5165\u5e93\u3001\u9500\u552e\u51fa\u5e93\u3001\u54c1\u79cd\u8c03\u6574\u51fa\u5165\u5e93\u3001\u8c03\u62e8\u51fa\u5165\u5e93\u3001\u76d8\u4e8f\u76d8\u76c8\u6570\u636e\u91cf&#xff1a;\u6bcf\u6708\u7ea6 5 \u4e07\u884c&#xff0c;24 \u4e2a\u6708\u603b\u8ba1\u7ea6 120 \u4e07\u884c&amp;#xf","og_url":"https:\/\/www.wsisp.com\/helps\/63303.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-21T12:16:46+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/63303.html","url":"https:\/\/www.wsisp.com\/helps\/63303.html","name":"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-21T12:16:46+00:00","dateModified":"2026-01-21T12:16:46+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/63303.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/63303.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/63303.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5b58\u8d27\u6536\u53d1\u5b58\u6838\u7b97\uff08\u5148\u8fdb\u5148\u51fa\u6cd5\uff09- Pandas \u5b9e\u73b0"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=63303"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63303\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=63303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=63303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=63303"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=63303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}