{"id":5254,"date":"2020-05-08T19:03:11","date_gmt":"2020-05-08T11:03:11","guid":{"rendered":"https:\/\/vip.fxxkpython.com\/?p=5254"},"modified":"2020-05-08T19:03:13","modified_gmt":"2020-05-08T11:03:13","slug":"python-%e6%95%b0%e6%8d%ae%e5%8f%af%e8%a7%86%e5%8c%96-07-pandas-%e6%95%b0%e6%8d%ae%e6%93%8d%e4%bd%9c%e4%b9%8b%e6%8e%92%e5%ba%8f%ef%bc%8c%e6%95%b0%e6%8d%ae%e7%bb%9f%e8%ae%a1%e8%ae%a1%e7%ae%97%ef%bc%8c","status":"publish","type":"post","link":"https:\/\/vip.fxxkpython.com\/?p=5254","title":{"rendered":"Python \u6570\u636e\u53ef\u89c6\u5316 07 | pandas \u6570\u636e\u64cd\u4f5c\u4e4b\u6392\u5e8f\uff0c\u6570\u636e\u7edf\u8ba1\u8ba1\u7b97\uff0c\u6570\u636e\u5206\u7c7b"},"content":{"rendered":"\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u7ee7\u7eed\u6765\u4e86\u89e3 pandas \u7684\u5e38\u7528\u64cd\u4f5c\u3002<\/p>\n\n\n\n<h2>\u6392\u5e8f<\/h2>\n\n\n\n<p>\u5bf9\u4e8e pands \u4e2d\u7684 Series \u548c DataFrame \u90fd\u6709\u6392\u5e8f\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7\u7d22\u5f15\u6216\u8005\u76f8\u5173\u7684\u503c\u8fdb\u884c\u6392\u5e8f\u3002<\/p>\n\n\n\n<h3>Series \u7684\u6392\u5e8f<\/h3>\n\n\n\n<p>\u6211\u4eec\u5148\u6765\u521b\u5efa\u4e00\u4e2a Series\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"826\" height=\"226\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-00-32.png\" alt=\"\" class=\"wp-image-5255\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-00-32.png 826w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-00-32-300x82.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-00-32-768x210.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-00-32-769x210.png 769w\" sizes=\"(max-width: 826px) 100vw, 826px\" \/><\/figure><\/div>\n\n\n\n<h4>\u901a\u8fc7 index \u6392\u5e8f<\/h4>\n\n\n\n<p>\u53ef\u4ee5\u8c03\u7528 sort_index \u65b9\u6cd5\u8fdb\u884c\u6392\u5e8f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"303\" height=\"209\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-01-46.png\" alt=\"\" class=\"wp-image-5256\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-01-46.png 303w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-01-46-300x207.png 300w\" sizes=\"(max-width: 303px) 100vw, 303px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"mce_9\">\u5012\u5e8f<\/h4>\n\n\n\n<p>\u901a\u8fc7\u6307\u5b9a ascending=False \u6765\u5012\u5e8f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"461\" height=\"213\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-03-09.png\" alt=\"\" class=\"wp-image-5257\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-03-09.png 461w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-03-09-300x139.png 300w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"mce_9\">\u901a\u8fc7 value \u6392\u5e8f<\/h4>\n\n\n\n<p>\u8c03\u7528 sort_values \u65b9\u6cd5\u5bf9\u503c\u8fdb\u884c\u6392\u5e8f\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"342\" height=\"222\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-04-24.png\" alt=\"\" class=\"wp-image-5258\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-04-24.png 342w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-04-24-300x195.png 300w\" sizes=\"(max-width: 342px) 100vw, 342px\" \/><\/figure><\/div>\n\n\n\n<h3 id=\"mce_19\">DataFrame \u7684\u6392\u5e8f<\/h3>\n\n\n\n<p>\u521b\u5efa\u4e00\u4e2a 5\u884c6\u5217 \u7684 DataFrame\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"619\" height=\"227\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-08-59.png\" alt=\"\" class=\"wp-image-5259\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-08-59.png 619w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-08-59-300x110.png 300w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"mce_15\">\u901a\u8fc7\u7d22\u5f15\u5012\u5e8f<\/h4>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"613\" height=\"215\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-09-48.png\" alt=\"\" class=\"wp-image-5260\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-09-48.png 613w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-09-48-300x105.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/figure><\/div>\n\n\n\n<h4 id=\"mce_24\">\u901a\u8fc7\u503c\u6392\u5e8f<\/h4>\n\n\n\n<p>\u56e0\u4e3a DataFrame \u662f\u7531\u591a\u884c\u548c\u5217\uff08Series\uff09\u7ec4\u6210\u7684\uff0c\u6240\u4ee5\u5728\u6392\u5e8f\u7684\u65f6\u5019\u9700\u8981\u6307\u5b9a\u4e00\u4e0b\uff0c\u4ee5\u7b2c\u4e00\u884c\u7684\u503c\u8fdb\u884c\u6392\u5e8f\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%3D5254\">\u767b\u9646<\/a> \u540e\u624d\u53ef\u4ee5\u6d4f\u89c8<\/div>\u8fd9\u65f6\u5019\u5f97\u5230\u7684 res \u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"793\" height=\"333\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-55-18.png\" alt=\"\" class=\"wp-image-5273\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-55-18.png 793w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-55-18-300x126.png 300w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-55-18-768x323.png 768w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-55-18-769x323.png 769w\" sizes=\"(max-width: 793px) 100vw, 793px\" \/><\/figure><\/div>\n\n\n\n<p>\u53ef\u4ee5\u8fdb\u884c\u7edf\u8ba1\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"402\" height=\"124\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-56-00.png\" alt=\"\" class=\"wp-image-5274\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-56-00.png 402w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-56-00-300x93.png 300w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" width=\"389\" height=\"125\" src=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-59-08.png\" alt=\"\" class=\"wp-image-5275\" srcset=\"https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-59-08.png 389w, https:\/\/vip.fxxkpython.com\/wp-content\/uploads\/2020\/05\/Screenshot-from-2020-05-08-18-59-08-300x96.png 300w\" sizes=\"(max-width: 389px) 100vw, 389px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u4e0b\u6765\u6211\u4eec\u7ee7\u7eed\u6765\u4e86\u89e3 pandas \u7684\u5e38\u7528\u64cd\u4f5c\u3002 \u6392\u5e8f \u5bf9\u4e8e pands \u4e2d\u7684 Series \u548c DataFrame \u90fd\u6709\u6392\u5e8f\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u901a\u8fc7\u7d22\u5f15\u6216\u8005\u76f8\u5173\u7684\u503c\u8fdb\u884c\u6392\u5e8f\u3002 Series \u7684\u6392\u5e8f \u6211\u4eec\u5148\u6765\u521b\u5efa\u4e00\u4e2a Series\uff1a \u901a\u8fc7 index \u6392\u5e8f &hellip;<\/p>\n","protected":false},"author":1,"featured_media":5273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[393],"tags":[411,19,417,427,429,428],"_links":{"self":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5254"}],"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=5254"}],"version-history":[{"count":1,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5254\/revisions"}],"predecessor-version":[{"id":5276,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/posts\/5254\/revisions\/5276"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=\/wp\/v2\/media\/5273"}],"wp:attachment":[{"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vip.fxxkpython.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}