{"id":5181,"date":"2020-04-30T23:42:54","date_gmt":"2020-04-30T15:42:54","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=5181"},"modified":"2020-04-30T23:42:58","modified_gmt":"2020-04-30T15:42:58","slug":"python-%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96-05-pandas-%e6%95%b0%e6%8d%ae%e6%93%8d%e4%bd%9c%e4%b9%8bdataframe","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=5181","title":{"rendered":"Python \u6570\u636e\u53ef\u89c6\u5316 05 | pandas \u6570\u636e\u64cd\u4f5c\u4e4bDataFrame"},"content":{"rendered":"\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u7ee7\u7eed\u719f\u6089 pandas \u7684\u4f7f\u7528\uff0c\u53e6\u4e00\u79cd\u5e38\u7528\u5230\u7684\u6570\u636e\u7ed3\u6784 DataFrame\u3002<\/p>\n\n\n\n<h2>\u4ec0\u4e48\u662fDataFrame<\/h2>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u628a DataFrame \u7406\u89e3\u4e3a\u8868\u683c\uff0c\u8868\u683c\u6211\u4eec\u90fd\u73a9\u8fc7\uff0c\u6709\u884c\u6709\u5217\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u884c\u7684\u7d22\u5f15\u548c\u5217\u7684\u7d22\u5f15\u6765\u83b7\u53d6\u76f8\u5173\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"292\" height=\"445\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-04-55.png\" alt=\"\" class=\"wp-image-5184\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-04-55.png 292w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-04-55-197x300.png 197w\" sizes=\"(max-width: 292px) 100vw, 292px\" \/><\/figure><\/div>\n\n\n\n<h2 id=\"mce_2\">DataFrame \u7684\u521b\u5efa<\/h2>\n\n\n\n<p>\u5148\u5bfc\u5165\u76f8\u5173\u7684\u5e93\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>from pandas import DataFrame<\/p><\/blockquote>\n\n\n\n<h3>\u901a\u8fc7\u5b57\u5178\u521b\u5efa<\/h3>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u7684 key-value \u6765\u521b\u5efa DataFrame\uff0c\u6bd4\u5982\u5c06 key \u4f5c\u4e3a\u8868\u5934\uff0c\u800c value \u53ef\u4ee5\u5b9a\u4e49\u4e3a list \u6765\u663e\u793a\u6bcf\u4e00\u5217\u7684\u6570\u636e\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"508\" height=\"85\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-22.png\" alt=\"\" class=\"wp-image-5185\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-22.png 508w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-22-300x50.png 300w\" sizes=\"(max-width: 508px) 100vw, 508px\" \/><\/figure><\/div>\n\n\n\n<p>\u63a5\u7740\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 DataFrame \u65b9\u6cd5\u5c06\u5176\u8f6c\u5316\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"453\" height=\"205\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-53.png\" alt=\"\" class=\"wp-image-5186\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-53.png 453w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-21-10-53-300x136.png 300w\" sizes=\"(max-width: 453px) 100vw, 453px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"mce_16\">\u901a\u8fc7 Series \u521b\u5efa<\/h3>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u521a\u624d\u7684 data \u521b\u5efa Series\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"571\" height=\"267\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-00-26.png\" alt=\"\" class=\"wp-image-5189\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-00-26.png 571w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-00-26-300x140.png 300w\" sizes=\"(max-width: 571px) 100vw, 571px\" \/><\/figure><\/div>\n\n\n\n<p>\u63a5\u7740\u6211\u4eec\u53ef\u4ee5\u4ee5\u8fd9\u6837\u7684\u65b9\u5f0f\u901a\u8fc7 Series \u521b\u5efa DataFrame \uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"484\" height=\"152\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-01-55.png\" alt=\"\" class=\"wp-image-5190\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-01-55.png 484w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-01-55-300x94.png 300w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/figure><\/div>\n\n\n\n<p>\u4e0d\u8fc7\u8fd9\u65f6\u5019\u7684 DataFrame \u5e76\u4e0d\u662f\u6211\u4eec\u60f3\u7684\u90a3\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 index \u6765\u6307\u5b9a \uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"683\" height=\"142\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-02-45.png\" alt=\"\" class=\"wp-image-5191\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-02-45.png 683w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/04\/Screenshot-from-2020-04-30-23-02-45-300x62.png 300w\" sizes=\"(max-width: 683px) 100vw, 683px\" \/><\/figure><\/div>\n\n\n\n<p>\u8fd8\u53ef\u4ee5\u901a\u8fc7 T \u6765\u53cd\u8f6c\uff1a<div style=\"text-align:center;border:1px dashed #FF9A9A;padding:8px;margin:10px auto;color:#FF6666;\">\u672c\u6587\u9690\u85cf\u5185\u5bb9 <a href=\"https:\/\/vip.fxxkpython.com\/wp-login.php?redirect_to=https%3A%2F%2Fvip.fxxkpython.com%2F%3Fp%3D5181\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div> ok\uff0c\u4ee5\u4e0a\u5c31\u662f DataFrame \u7684\u521b\u5efa\u548c\u8bbf\u95ee\u7684\u5e38\u7528\u64cd\u4f5c\uff0c\u4e0b\u4e00\u7bc7\u8fd8\u4f1a\u7ee7\u7eed\u7ed9\u4f60\u4ecb\u7ecd\u4e00\u4e0b pandas \u7684\u4e00\u4e9b\u9a9a\u64cd\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u7ee7\u7eed\u719f\u6089 pandas \u7684\u4f7f\u7528\uff0c\u53e6\u4e00\u79cd\u5e38\u7528\u5230\u7684\u6570\u636e\u7ed3\u6784 DataFrame\u3002 \u4ec0\u4e48\u662fDataFrame \u4f60\u53ef\u4ee5\u628a DataFrame \u7406\u89e3\u4e3a\u8868\u683c\uff0c\u8868\u683c\u6211\u4eec\u90fd\u73a9\u8fc7\uff0c\u6709\u884c\u6709\u5217\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u884c\u7684\u7d22\u5f15\u548c\u5217\u7684\u7d22\u5f15\u6765\u83b7\u53d6\u76f8\u5173\u7684\u6570\u636e\u3002 DataFram&hellip;<\/p>\n","protected":false},"author":1,"featured_media":5194,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[393],"tags":[414,411,412,415,416],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5181"}],"collection":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5181"}],"version-history":[{"count":2,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5181\/revisions"}],"predecessor-version":[{"id":5204,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5181\/revisions\/5204"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/5194"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}