{"id":2751,"date":"2019-12-07T21:19:06","date_gmt":"2019-12-07T12:19:06","guid":{"rendered":"https:\/\/analysis-navi.com\/?p=2751"},"modified":"2025-06-08T22:43:11","modified_gmt":"2025-06-08T13:43:11","slug":"python%e3%81%a7%e3%83%87%e3%83%bc%e3%82%bf%e9%96%93%e3%81%ae%e7%9b%b8%e9%96%a2%e4%bf%82%e6%95%b0%e3%82%92%e4%b8%80%e6%b0%97%e3%81%ab%e6%b1%82%e3%82%81%e3%82%8b","status":"publish","type":"post","link":"https:\/\/analysis-navi.com\/?p=2751","title":{"rendered":"Python\u3067\u76f8\u95a2\u4fc2\u6570\u3092\u6c42\u3081\u3066\u53ef\u8996\u5316\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u76f8\u95a2\u5206\u6790\u3092Python\u3067\u5b9f\u884c\u3057\u3001\u53ef\u8996\u5316\u307e\u3067\u884c\u3063\u3066\u307f\u307e\u3059\u3002<br><a href=\"https:\/\/analysis-navi.com\/?p=1142\">Excel\u3067\u3082\u76f8\u95a2\u5206\u6790\u306f\u53ef\u80fd<\/a>\u3067\u3059\u304c\u3001Python\u3067\u5b9f\u884c\u3059\u308c\u3070\u4e00\u5ea6\u306b\u5168\u30c7\u30fc\u30bf\u306e\u5206\u5e03\u306e\u50be\u5411\u304c\u4e00\u6c17\u306b\u898b\u308c\u305f\u308a\u3001\u8996\u899a\u7684\u306b\u7f8e\u3057\u3044\u56f3\u3092\u4f5c\u6210\u3057\u305f\u308a\u3068\u3001\u30cf\u30a4\u30ec\u30d9\u30eb\u306a\u5206\u6790\u304c\u7c21\u5358\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f<\/h2>\n\n\n\n<p>\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30015\u79d1\u76ee\u30c6\u30b9\u30c8\u306e\u6210\u7e3e\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u76f8\u95a2\u5206\u6790\u3092\u884c\u3063\u3066\u307f\u307e\u3059\u3002<br><img decoding=\"async\" src=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43.png\" alt=\"\" width=\"579\" height=\"453\" class=\"alignnone size-full wp-image-2881\" srcset=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43.png 1158w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43-511x400.png 511w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43-300x235.png 300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43-768x601.png 768w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/a382801a58039ac15fdc3dbf69db7f43-1024x801.png 1024w\" sizes=\"(max-width: 579px) 100vw, 579px\" \/><\/p>\n\n\n\n<p>\u307e\u305a\u306f\u3001\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306b\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\nimport numpy as np\nimport pandas as pd\n\ndf_score = pd.read_csv(\"\u6210\u7e3e\u30c7\u30fc\u30bf.csv\",index_col=\"\u540d\u524d\")<\/pre>\n\n\n\n<p>\u4eca\u56de\u306f\u3053\u306e\u30c7\u30fc\u30bf\u3092\u7528\u3044\u3066\u5206\u6790\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c7\u30fc\u30bf\u9593\u306e\u76f8\u95a2\u4fc2\u6570\u306e\u8a08\u7b97<\/h2>\n\n\n\n<p>\u307e\u305a\u3001\u5358\u7d14\u306b\u5168\u3066\u306e\u30c7\u30fc\u30bf\u9593\u306e\u76f8\u95a2\u4fc2\u6570\u3092\u898b\u305f\u3044\u3060\u3051\u306a\u3089\u975e\u5e38\u306b\u7c21\u5358\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">df_corr = df_corr = df_score.corr()\nprint(df_corr)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">          \u56fd\u8a9e        \u7b97\u6570        \u82f1\u8a9e        \u7406\u79d1        \u793e\u4f1a\n\u56fd\u8a9e  1.000000  0.320452  0.532979  0.402017  0.465048\n\u7b97\u6570  0.320452  1.000000  0.146600  0.589234  0.344563\n\u82f1\u8a9e  0.532979  0.146600  1.000000  0.273339  0.558078\n\u7406\u79d1  0.402017  0.589234  0.273339  1.000000  0.509317\n\u793e\u4f1a  0.465048  0.344563  0.558078  0.509317  1.000000<\/pre>\n\n\n\n<p><strong>corr()<\/strong>\u3092\u547c\u3073\u51fa\u3059\u3068\u3001<strong><span style=\"background-color: #87cefa;\">\u30c7\u30fc\u30bf\u306e\u4e2d\u304b\u3089\u6570\u5024\u306e\u5217\u306e\u307f\u62bd\u51fa\u3057\u3066<\/span><\/strong>\u3001\u305d\u306e\u5168\u3066\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u3064\u3044\u3066\u76f8\u95a2\u4fc2\u6570\u3092\u4e00\u6c17\u306b\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u4eca\u56de\u306e\u5834\u5408\u306f\u3001\u6570\u5024\u3067\u306f\u306a\u3044\u300c\u6027\u5225\u300d\u5217\u3092\u81ea\u52d5\u3067\u6392\u9664\u3057\u3066\u8a08\u7b97\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6570\u5024\u306a\u306e\u306b\u76f8\u95a2\u4fc2\u6570\u304c\u8a08\u7b97\u3055\u308c\u306a\u3044\u5834\u5408\u306f\u3001\u898b\u305f\u76ee\u306f\u6570\u5024\u306a\u306e\u306b\u6587\u5b57\u5217\u578b\u3068\u5224\u5225\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001<strong><span style=\"background-color: #87cefa;\">dtypes\u306a\u3069\u3067\u5217\u3054\u3068\u306e\u578b\u3092\u78ba\u8a8d<\/span><\/strong>\u3059\u308b\u3068\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3001<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Seaborn\u306b\u3088\u308b\u76f8\u95a2\u4fc2\u6570\u306e\u53ef\u8996\u5316<\/h2>\n\n\n\n<p>\u3055\u3066\u3001\u7d50\u679c\u3092\u8996\u899a\u7684\u306b\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<br>\u4eca\u56de\u306e\u3088\u3046\u306b5\u8981\u7d20\u304f\u3089\u3044\u3067\u3042\u308c\u3070\u6570\u5024\u306e\u8868\u3060\u3051\u3067\u3082\u305d\u3053\u307e\u3067\u56f0\u308a\u307e\u305b\u3093\u304c\u300120\u00d720\u304f\u3089\u3044\u306b\u306a\u3063\u3066\u304f\u308b\u3068\u3001\u3069\u3053\u306e\u76f8\u95a2\u4fc2\u6570\u304c\u9ad8\u304f\u3066\u3069\u3053\u304c\u4f4e\u3044\u306e\u304b\u3001\u30d1\u30c3\u3068\u898b\u3067\u5206\u304b\u308a\u3065\u3089\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br>\u305d\u3093\u306a\u6642\u306f\u56f3\u306b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001<strong>seaborn<\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3048\u3070\u56f3\u306b\u3059\u308b\u306e\u3082\u7c21\u5358\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import matplotlib.pyplot as plt\nimport japanize_matplotlib\nimport seaborn as sns\n\nsns.heatmap(df_corr)<\/pre>\n\n\n\n<p><strong>matplotlib<\/strong>\u3068\u3001matplotlib\u306e\u65e5\u672c\u8a9e\u8868\u793a\u30e9\u30a4\u30d6\u30e9\u30ea<strong>japanize_matplotlib<\/strong>\u3082\u4f75\u305b\u3066\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u5b9f\u884c\u3059\u308b\u3068\u30fb\u30fb\u30fb<br><img decoding=\"async\" src=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/8a155334d505010a0bbf13b72759c4c7.png\" alt=\"\" width=\"400\" height=\"275\" class=\"alignnone size-full wp-image-2885\" srcset=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/8a155334d505010a0bbf13b72759c4c7.png 800w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/8a155334d505010a0bbf13b72759c4c7-582x400.png 582w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/8a155334d505010a0bbf13b72759c4c7-300x206.png 300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/8a155334d505010a0bbf13b72759c4c7-768x528.png 768w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/p>\n\n\n\n<p>\u56f3\u306b\u306a\u3063\u3066\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<br>\u76f8\u95a2\u4fc2\u6570\u304c\u9ad8\u3044\u307b\u3069\u8272\u304c\u767d\u304f\u3001\u4f4e\u3044\u307b\u3069\u8272\u304c\u9ed2\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u306a\u3089<strong><span style=\"background-color: #87cefa;\">\u6570\u5b57\u306e\u7f85\u5217\u3092\u898b\u306a\u304f\u3066\u3082\u3001\u8272\u306e\u6fc3\u3055\u3067\u76f8\u95a2\u306e\u9ad8\u3044\u4f4e\u3044\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/span><\/strong><br>\u304a\u6b21\u306f\u3001\u3082\u3046\u5c11\u3057\u3053\u306e\u56f3\u306e\u898b\u305f\u76ee\u3092\u6574\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u898b\u305f\u76ee\u306e\u8abf\u6574<\/h2>\n\n\n\n<p>\u898b\u305f\u76ee\u304c\u7dba\u9e97\u304b\u3069\u3046\u304b\u306f\u898b\u308b\u4eba\u306b\u3088\u3063\u3066\u5909\u308f\u308a\u307e\u3059\u306e\u3067\u4e00\u6982\u306b\u3053\u308c\u304c\u6b63\u89e3\u3068\u306f\u8a00\u3048\u307e\u305b\u3093\u304c\u3001\u56f3\u306e\u4e2d\u306b\u76f8\u95a2\u4fc2\u6570\u3092\u5c0f\u6570\u70b9\u7b2c2\u4f4d\u307e\u3067\u5165\u308c\u3066\u3001\u8272\u5473\u3092\u9752\u306b\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sns.set_context(\"talk\")\nfig = plt.subplots(figsize=(8, 8))\n\nsns.heatmap(df_corr, annot=True,fmt='.2f',cmap='Blues',square=True)<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1036\" height=\"938\" src=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21.png\" alt=\"\" class=\"wp-image-2886\" srcset=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21.png 1036w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21-442x400.png 442w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21-300x272.png 300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21-768x695.png 768w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/2fbf3de403c596797c0150a26dfbdd21-1024x927.png 1024w\" sizes=\"(max-width: 1036px) 100vw, 1036px\" \/><\/figure>\n\n\n\n\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u898b\u305f\u76ee\u3092\u6574\u3048\u308c\u3070\u3001\u305d\u306e\u307e\u307ePowerPoint\u306b\u63b2\u8f09\u3057\u3066\u3082\u554f\u984c\u306a\u3044\u56f3\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9f\u969b\u306e\u5206\u5e03\u306e\u78ba\u8a8d<\/h2>\n\n\n\n<p>\u3055\u3066\u3001\u3053\u308c\u3067\u5168\u3066\u306e\u5909\u6570\u9593\u306e\u76f8\u95a2\u5909\u6570\u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002<br>\u3057\u304b\u3057\u3001<a href=\"https:\/\/analysis-navi.com\/?p=1142\">\u76f8\u95a2\u5206\u6790\u306e\u8a18\u4e8b<\/a>\u306b\u3066\u8ff0\u3079\u305f\u3088\u3046\u306b\u3001\u76f8\u95a2\u4fc2\u6570\u306e\u5024\u3092\u305d\u306e\u307e\u307e\u9d5c\u5451\u307f\u306b\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u306f\u5371\u967a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u8a73\u7d30\u306f\u4e0a\u306e\u8a18\u4e8b\u306b\u3086\u305a\u308a\u307e\u3059\u304c\u3001<strong><span style=\"background-color: #87cefa;\">\u5b9f\u969b\u306b\u5206\u5e03\u304c\u3069\u3046\u306a\u3063\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u7406\u60f3<\/span><\/strong>\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u3093\u306a\u6642\u3082seaborn\u3092\u4f7f\u3048\u3070\u4e00\u767a\u3067\u3059\u3002<br><strong>pairplot<\/strong>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3068\u3001\u5168\u3066\u306e\u5909\u6570\u9593\u306e\u6563\u5e03\u56f3\u3092\u898b\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u3055\u3089\u306b\u7537\u5973\u5225\u306e\u50be\u5411\u3082\u898b\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sns.pairplot(df_score,hue=\"\u6027\u5225\")<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"976\" height=\"875\" src=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/download.png\" alt=\"\" class=\"wp-image-2884\" srcset=\"https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/download.png 976w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/download-446x400.png 446w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/download-300x269.png 300w, https:\/\/analysis-navi.com\/wp-content\/uploads\/2019\/12\/download-768x689.png 768w\" sizes=\"(max-width: 976px) 100vw, 976px\" \/><\/figure>\n\n\n\n\n\n\n\n<p>\u5168\u30c7\u30fc\u30bf\u9593\u306e\u5206\u5e03\u56f3\u304c\u7537\u5973\u3067\u30ab\u30e9\u30fc\u5225\u306b\u8868\u793a\u3055\u308c\u3001\u5bfe\u89d2\u7dda\u4e0a\u306b\u306f\u79d1\u76ee\u5225\u306e\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u304c\u4e26\u3093\u3067\u3044\u307e\u3059\u3002<br>\u6563\u5e03\u56f3\u307e\u3067\u898b\u308c\u3070\u3001\u76f8\u95a2\u4fc2\u6570\u3092\u4fe1\u3058\u3066\u3088\u3044\u304b\u3069\u3046\u304b\u306e\u5224\u65ad\u6750\u6599\u306b\u306a\u308a\u307e\u3059\u3057\u3001\u7537\u5973\u5225\u306e\u50be\u5411\u307e\u3067\u63b4\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u304c\u3001Python\u306b\u304a\u3051\u308b\u76f8\u95a2\u5206\u6790\u306e\u65b9\u6cd5\u3067\u3057\u305f\u3002<br>\u307b\u3093\u306e\u6570\u884c\u3067\u69d8\u3005\u306a\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u306e\u5206\u6790\u304c\u3067\u304d\u307e\u3059\u306e\u3067\u3001\u662f\u975e\u6d3b\u7528\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76f8\u95a2\u5206\u6790\u3092Python\u3067\u5b9f\u884c\u3057\u3001\u53ef\u8996\u5316\u307e\u3067\u884c\u3063\u3066\u307f\u307e\u3059\u3002Excel\u3067\u3082\u76f8\u95a2\u5206\u6790\u306f\u53ef\u80fd\u3067\u3059\u304c\u3001Python\u3067\u5b9f\u884c\u3059\u308c\u3070\u4e00\u5ea6\u306b\u5168\u30c7\u30fc\u30bf\u306e\u5206\u5e03\u306e\u50be\u5411\u304c\u4e00\u6c17\u306b\u898b\u308c\u305f\u308a\u3001\u8996\u899a\u7684\u306b\u7f8e\u3057\u3044\u56f3\u3092\u4f5c\u6210\u3057\u305f\u308a\u3068\u3001\u30cf\u30a4\u30ec\u30d9\u30eb\u306a\u5206\u6790\u304c\u7c21\u5358\u306b\u3067\u304d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4971,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"swell_btn_cv_data":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[129],"tags":[131,134],"class_list":["post-2751","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-study","tag-stats","tag-python"],"_links":{"self":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/2751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2751"}],"version-history":[{"count":13,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/2751\/revisions"}],"predecessor-version":[{"id":5089,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/posts\/2751\/revisions\/5089"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=\/wp\/v2\/media\/4971"}],"wp:attachment":[{"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/analysis-navi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}