{"id":2023,"date":"2020-09-03T23:44:33","date_gmt":"2020-09-03T14:44:33","guid":{"rendered":"https:\/\/obenkyolab.com\/?p=2023"},"modified":"2020-09-03T23:49:12","modified_gmt":"2020-09-03T14:49:12","slug":"%e3%80%90python%e3%80%91%e3%83%99%e3%82%a4%e3%82%ba%e3%81%ae%e5%ae%9a%e7%90%86%e3%81%ae%e7%a2%ba%e8%aa%8d","status":"publish","type":"post","link":"https:\/\/obenkyolab.com\/?p=2023","title":{"rendered":"\u3010Python\u3011\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3092\u5b9f\u969b\u306b\u8a66\u884c\u3057\u3066\u78ba\u8a8d"},"content":{"rendered":"\n\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/obenkyolab.com\/?p=2023\/#%E3%83%99%E3%82%A4%E3%82%BA%E3%81%AE%E5%AE%9A%E7%90%86%E3%81%A8%E3%81%AF\" >\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3068\u306f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/obenkyolab.com\/?p=2023\/#%E5%85%B7%E4%BD%93%E7%9A%84%E3%81%AA%E5%95%8F%E9%A1%8C\" >\u5177\u4f53\u7684\u306a\u554f\u984c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/obenkyolab.com\/?p=2023\/#Python%E3%81%A7%E5%AE%9F%E9%9A%9B%E3%81%AB%E7%A2%BA%E8%AA%8D\" >Python\u3067\u5b9f\u969b\u306b\u78ba\u8a8d<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E3%83%99%E3%82%A4%E3%82%BA%E3%81%AE%E5%AE%9A%E7%90%86%E3%81%A8%E3%81%AF\"><\/span>\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3068\u306f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u3042\u308b\u4e8b\u8c61\u306b\u3064\u3044\u3066\u3001\u305d\u306e\u539f\u56e0\u3068\u306a\u308b\u5019\u88dc\uff08\u4e92\u3044\u306b\u72ec\u7acb\uff09\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u3001\u305d\u308c\u305e\u308c\u306e\u539f\u56e0\u306f\u767a\u751f\u78ba\u7387\u3092\u6301\u3063\u3066\u3044\u308b\u3068\u3059\u308b\u3002<br>\u3053\u306e\u6642\u3001\u3042\u308b\u4e8b\u8c61\u304c\u767a\u751f\u3057\u305f\u3068\u304d\u306b\u3001\u305d\u306e\u539f\u56e0\u3067\u3042\u308b\u78ba\u7387\u304c\u3044\u304f\u3089\u304b\u3001\u3068\u3044\u3046\u554f\u984c\u306b\u4f7f\u7528\u3067\u304d\u308b\u306e\u304c\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u5f0f\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>$$P(B \\backslash A)=\\frac {P(A \\backslash B)P(B)} {P(A)}$$<\/p>\n\n\n\n<p>\\( P(B \\backslash A) \\)\uff1a\u4e8b\u8c61A\u306e\u767a\u751f\u5f8c\u306e\u4e8b\u8c61B\u306e\u4e8b\u5f8c\u78ba\u7387<br>\\( P(B)\\)\uff1a\u4e8b\u8c61B\u306e\u4e8b\u524d\u78ba\u7387<br>\\(P(A)\\)\uff1a\u4e8b\u8c61A\u306e\u767a\u751f\u3059\u308b\u78ba\u7387<br>\\( P(A \\backslash B) \\)\uff1a\u4e8b\u8c61B\u304c\u767a\u751f\u3059\u308b\u3068\u3044\u3046\u6761\u4ef6\u4e0b\u3067\u306e\u4e8b\u8c61A\u306e\u767a\u751f\u78ba\u7387<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%85%B7%E4%BD%93%E7%9A%84%E3%81%AA%E5%95%8F%E9%A1%8C\"><\/span>\u5177\u4f53\u7684\u306a\u554f\u984c<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u6b21\u306e\u3088\u3046\u306a\u4f8b\u984c\u3092\u8003\u3048\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\">\u4f8b\u984c<\/span><br>\u3042\u308b\u5927\u5b66\u306e\u5b66\u90e8\u306b\u304a\u3051\u308b\u79d1\u306e\u5272\u5408\u306fA\u79d130%\u3001B\u79d150%\u3001C\u79d120%\u3068\u3059\u308b\u3002<br>\u3053\u306e3\u79d1\u306e\u5b66\u751f\u304cIT\u7cfb\u4f01\u696d\u306b\u5c31\u8077\u3059\u308b\u78ba\u7387\u306f\u305d\u308c\u305e\u308c60%\u300130%\u300110%\u3067\u3042\u308b\u3002<br>\u3042\u308b\u5b66\u751f\u304cIT\u7cfb\u4f01\u696d\u306b\u5c31\u8077\u3057\u305f\u3068\u304d\u3001\u305d\u306e\u5b66\u751f\u304cB\u79d1\u3092\u5c02\u653b\u3057\u3066\u3044\u305f\u78ba\u7387\u306f\u3044\u304f\u3089\u304b\u3002<\/p>\n\n\n\n<p>\u30d9\u30a4\u30ba\u306e\u5f0f\u306b\u5f53\u3066\u306f\u3081\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>$$P(B \\backslash I) = \\frac {P(I \\backslash B)P(B)} {P(I)}$$<\/p>\n\n\n\n<p>$$  =\\frac{0.5\\times 0.3}{0.3\\times 0.6 + 0.5\\times 0.3 +0.2\\times 0.1}$$<\/p>\n\n\n\n<p>=0.4285714285714286<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python%E3%81%A7%E5%AE%9F%E9%9A%9B%E3%81%AB%E7%A2%BA%E8%AA%8D\"><\/span>Python\u3067\u5b9f\u969b\u306b\u78ba\u8a8d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4e0a\u8a18\u306e\u554f\u984c\u3092python\u306e\u4e2d\u3067\u5b9f\u969b\u306b\u8a66\u884c\u3057\u3066\u6570\u5b57\u304c\u4e0a\u8a18\u306e\u8a08\u7b97\u7d50\u679c\u306b\u306a\u308b\u306e\u304b\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u4f5c\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c0\u30df\u30fc\u30c7\u30fc\u30bf\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>data.csv<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u9023\u756a,\u6c0f\u540d\uff08\u30ab\u30bf\u30ab\u30ca\uff09,\u79d1,\u5c31\u8077\u5148\n1,\u30bf\u30ab\u30b7\u30de\u30b7\u30db,A,IT\n2,\u30aa\u30ab\u30d9\u30b1\u30f3\u30be\u30a6,A,IT\n3,\u30a6\u30e1\u30cf\u30e9\u30ce\u30ea\u30b3,A,IT\n4,\u30ca\u30ab\u30aa\u30ab\u30cf\u30ca,A,IT\n5,\u30df\u30bf\u30ea\u30aa,A,IT\n6,\u30e2\u30ea\u30a4\u30ad\u30e8\u30b3,A,IT\n7,\u30cf\u30ca\u30a4\u30b7\u30ce,A,IT\n8,\u30aa\u30aa\u30ef\u30c0\u30b1\u30f3\u30b9\u30b1,A,IT\n9,\u30b9\u30ac\u30ce\u30ea\u30ca,A,IT\n10,\u30db\u30f3\u30b4\u30a6\u30c4\u30ad\u30c8,A,IT\n11,\u30e4\u30ca\u30ae\u30cf\u30e9\u30d2\u30c7\u30e8,A,IT\n12,\u30e4\u30de\u30e2\u30c8\u30b7\u30f3\u30e4,A,IT\n13,\u30e8\u30b7\u30b6\u30ef\u30a2\u30aa,A,IT\n14,\u30d2\u30e9\u30d0\u30e4\u30b7\u30c1\u30a8,A,IT\n15,\u30d5\u30b8\u30ab\u30ef\u30a8\u30a4\u30b8,A,IT\n16,\u30e2\u30c1\u30c5\u30ad\u30c8\u30e2\u30e6\u30ad,A,IT\n17,\u30ad\u30bf\u30a2\u30a4\u30b3,A,IT\n18,\u30af\u30de\u30ac\u30e4\u30a2\u30ad\u30aa,A,IT\n19,\u30a4\u30b7\u30b6\u30ad\u30ab\u30ea\u30f3,A,\u305d\u306e\u4ed6\n20,\u30c8\u30df\u30ca\u30ac\u30c6\u30eb,A,\u305d\u306e\u4ed6\n21,\u30e2\u30ea\u30b7\u30de\u30bf\u30ed\u30a6,A,\u305d\u306e\u4ed6\n22,\u30e2\u30ea\u30ca\u30ac\u30de\u30ca,A,\u305d\u306e\u4ed6\n23,\u30bb\u30f3\u30c0\u30b5\u30aa\u30ea,A,\u305d\u306e\u4ed6\n24,\u30e4\u30de\u30b6\u30ad\u30e6\u30a6\u30be\u30a6,A,\u305d\u306e\u4ed6\n25,\u30ce\u30ed\u30e6\u30a6\u30d8\u30a4,A,\u305d\u306e\u4ed6\n26,\u30e4\u30de\u30a6\u30c1\u30ab\u30f3\u30ca,A,\u305d\u306e\u4ed6\n27,\u30d2\u30d3\u30ce\u30bf\u30ab\u30d5\u30df,A,\u305d\u306e\u4ed6\n28,\u30df\u30ba\u30bf\u30cb\u30c8\u30b7\u30d2\u30b3,A,\u305d\u306e\u4ed6\n29,\u30b7\u30ac\u30b7\u30b2\u30e6\u30ad,A,\u305d\u306e\u4ed6\n30,\u30df\u30ab\u30df\u30de\u30ea,A,\u305d\u306e\u4ed6\n31,\u30d5\u30ab\u30a4\u30e6\u30df,B,IT\n32,\u30e0\u30e9\u30aa\u30ab\u30ea\u30a8\u30b3,B,IT\n33,\u30cf\u30e9\u30c0\u30a2\u30ad\u30b3,B,IT\n34,\u30a4\u30a4\u30c0\u30ad\u30e8\u30b3,B,IT\n35,\u30ad\u30cf\u30e9\u30c1\u30d2\u30ed,B,IT\n36,\u30bf\u30ad\u30b1\u30f3\u30b8,B,IT\n37,\u30a4\u30af\u30bf\u30d5\u30d6\u30ad,B,IT\n38,\u30cf\u30de\u30c0\u30e4\u30b9\u30e6\u30ad,B,IT\n39,\u30b8\u30f3\u30dc\u30bf\u30a4\u30b8,B,IT\n40,\u30e8\u30cd\u30af\u30e9\u30ab\u30c4\u30df,B,IT\n41,\u30ab\u30ef\u30e2\u30c8\u30a2\u30e6,B,IT\n42,\u30a4\u30de\u30a4\u30ba\u30df\u30ab\u30ba\u30e6\u30ad,B,IT\n43,\u30cf\u30c3\u30c8\u30ea\u30de\u30b5\u30a2\u30ad,B,IT\n44,\u30ca\u30ac\u30e4\u30cf\u30eb\u30ab,B,IT\n45,\u30a8\u30ac\u30ef\u30ab\u30ec\u30f3,B,IT\n46,\u30aa\u30aa\u30a4\u30b7\u30a8\u30a4\u30b8,B,\u305d\u306e\u4ed6\n47,\u30a6\u30a8\u30e0\u30e9\u30e0\u30c4\u30aa,B,\u305d\u306e\u4ed6\n48,\u30ab\u30b2\u30e4\u30de\u30ab\u30ba\u30d2\u30b3,B,\u305d\u306e\u4ed6\n49,\u30db\u30ea\u30a8\u30ab\u30ba\u30d2\u30b5,B,\u305d\u306e\u4ed6\n50,\u30de\u30c4\u30c0\u30df\u30c1\u30aa,B,\u305d\u306e\u4ed6\n51,\u30ab\u30ef\u30b5\u30ad\u30e1\u30a4,B,\u305d\u306e\u4ed6\n52,\u30bf\u30c9\u30b3\u30ed\u30b5\u30e4\u30ab,B,\u305d\u306e\u4ed6\n53,\u30ad\u30af\u30c1\u30d6\u30f3\u30a4\u30c1,B,\u305d\u306e\u4ed6\n54,\u30a4\u30c1\u30cf\u30e9\u30a2\u30e4\u30cd,B,\u305d\u306e\u4ed6\n55,\u30bf\u30ca\u30d9\u30b3\u30c8\u30b3,B,\u305d\u306e\u4ed6\n56,\u30b5\u30ab\u30e2\u30c8\u30e2\u30df\u30b8,B,\u305d\u306e\u4ed6\n57,\u30c0\u30a4\u30ef\u30ad\u30e8\u30b3,B,\u305d\u306e\u4ed6\n58,\u30a2\u30aa\u30e4\u30ae\u30cf\u30eb\u30d2\u30b3,B,\u305d\u306e\u4ed6\n59,\u30df\u30ba\u30bf\u30cb\u30c8\u30b7\u30aa,B,\u305d\u306e\u4ed6\n60,\u30af\u30ed\u30ad\u30a2\u30ad\u30b3,B,\u305d\u306e\u4ed6\n61,\u30c4\u30ab\u30e2\u30c8\u30ab\u30c4\u30aa,B,\u305d\u306e\u4ed6\n62,\u30c8\u30df\u30bf\u30e6\u30ca,B,\u305d\u306e\u4ed6\n63,\u30d2\u30e9\u30ac\u30e6\u30ab,B,\u305d\u306e\u4ed6\n64,\u30a4\u30ca\u30d0\u30b1\u30a4\u30b8,B,\u305d\u306e\u4ed6\n65,\u30b7\u30ce\u30b6\u30ad\u30b1\u30f3\u30b9\u30b1,B,\u305d\u306e\u4ed6\n66,\u30e8\u30b7\u30c0\u30ce\u30ce\u30ab,B,\u305d\u306e\u4ed6\n67,\u30ab\u30ef\u30ca\u30e6\u30ad,B,\u305d\u306e\u4ed6\n68,\u30aa\u30aa\u30e2\u30ea\u30e6\u30c5\u30ad,B,\u305d\u306e\u4ed6\n69,\u30cf\u30b7\u30e2\u30c8\u30df\u30ba\u30ad,B,\u305d\u306e\u4ed6\n70,\u30e4\u30c4\u30bf\u30ea\u30f3\u30bf\u30ed\u30a6,B,\u305d\u306e\u4ed6\n71,\u30ab\u30df\u30e4\u30de\u30b9\u30ba\u30cd,B,\u305d\u306e\u4ed6\n72,\u30aa\u30ac\u30bf\u30ab\u30c4\u30a4\u30c1,B,\u305d\u306e\u4ed6\n73,\u30b7\u30e9\u30ab\u30ef\u30e4\u30b9\u30e6\u30ad,B,\u305d\u306e\u4ed6\n74,\u30b7\u30de\u30c5\u30e6\u30a6\u30b8,B,\u305d\u306e\u4ed6\n75,\u30de\u30ad\u30bf\u30a4\u30be\u30a6,B,\u305d\u306e\u4ed6\n76,\u30a4\u30c7\u30c4\u30cd\u30a2\u30ad,B,\u305d\u306e\u4ed6\n77,\u30d5\u30b8\u30e0\u30e9\u30c8\u30b7\u30e6\u30ad,B,\u305d\u306e\u4ed6\n78,\u30aa\u30aa\u30a4\u30b7\u30bf\u30b1\u30b7,B,\u305d\u306e\u4ed6\n79,\u30aa\u30aa\u30d0\u30ab\u30ba\u30de,B,\u305d\u306e\u4ed6\n80,\u30a6\u30e1\u30cf\u30e9\u30bf\u30ab\u30d5\u30df,B,\u305d\u306e\u4ed6\n81,\u30a2\u30ac\u30c4\u30de\u30b1\u30f3\u30be\u30a6,C,IT\n82,\u30ab\u30ef\u30cf\u30e9\u30e8\u30b7\u30aa,C,IT\n83,\u30e4\u30de\u30ca\u30ab\u30b7\u30e7\u30a6\u30a4\u30c1\u30ed\u30a6,C,\u305d\u306e\u4ed6\n84,\u30b9\u30c9\u30a6\u30de\u30b5\u30ad,C,\u305d\u306e\u4ed6\n85,\u30c4\u30e0\u30e9\u30ef\u30bf\u30eb,C,\u305d\u306e\u4ed6\n86,\u30a8\u30ce\u30e2\u30c8\u30ea\u30ab,C,\u305d\u306e\u4ed6\n87,\u30e0\u30ab\u30a4\u30d2\u30c7,C,\u305d\u306e\u4ed6\n88,\u30d2\u30d3\u30ce\u30ab\u30db,C,\u305d\u306e\u4ed6\n89,\u30a4\u30af\u30bf\u30c8\u30df\u30b3,C,\u305d\u306e\u4ed6\n90,\u30aa\u30aa\u30b5\u30ef\u30b9\u30df\u30c8,C,\u305d\u306e\u4ed6\n91,\u30ab\u30cd\u30b3\u30de\u30b5\u30b3,C,\u305d\u306e\u4ed6\n92,\u30a2\u30e9\u30ab\u30ef\u30ed\u30af\u30ed\u30a6,C,\u305d\u306e\u4ed6\n93,\u30ca\u30ab\u30e4\u30de\u30c1\u30e5\u30a6\u30be\u30a6,C,\u305d\u306e\u4ed6\n94,\u30ab\u30ef\u30d9\u30e8\u30b7\u30ab\u30ba,C,\u305d\u306e\u4ed6\n95,\u30c6\u30e9\u30a6\u30c1\u30ab\u30ba\u30d2\u30c8,C,\u305d\u306e\u4ed6\n96,\u30de\u30c4\u30e2\u30c8\u30a2\u30a4\u30ad,C,\u305d\u306e\u4ed6\n97,\u30aa\u30aa\u30d2\u30e9\u30ea\u30c3\u30ab,C,\u305d\u306e\u4ed6\n98,\u30e4\u30de\u30ac\u30bf\u30d2\u30ca\u30ce,C,\u305d\u306e\u4ed6\n99,\u30df\u30e4\u30ce\u30e4\u30b9\u30d2\u30ed,C,\u305d\u306e\u4ed6\n100,\u30a4\u30b7\u30b6\u30ab\u30b5\u30ca,C,\u305d\u306e\u4ed6\n\n<\/pre><\/div>\n\n\n<p>\u3053\u308c\u3092pandas\u3067\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport pandas as pd\ndata = pd.read_csv(&#039;data.csv&#039;)\n<\/pre><\/div>\n\n\n<p>\u5168\u4f53\u306e\u4e2d\u304b\u3089IT\u4f01\u696d\u306b\u5c31\u8077\u3057\u305f\u4eba\u3092\u62bd\u51fa\u3057\u307e\u3059\u300235\u4eba\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\ndata_it = data&#x5B;data&#x5B;&quot;\u5c31\u8077\u5148&quot;]==&#039;IT&#039;]\nlen(data_it)\n***\n35\n<\/pre><\/div>\n\n\n<p>\u3053\u306e\u4e2d\u304b\u3089\u30e9\u30f3\u30c0\u30e0\u306b\u4e00\u4eba\u9078\u3073\u3001\u305d\u306e\u4eba\u306e\u79d1\u3092\u8abf\u3079\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport random\nnum = random.randint(0, 34)\ndata_it_ri = data_it.reset_index(drop=&#039;true&#039;)\ndata_it_ri&#x5B;&#039;\u79d1&#039;]&#x5B;num]\n***\n&#039;A&#039;\n<\/pre><\/div>\n\n\n<p>\u3053\u308c\u3092\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3057\u884c\u3044\u3001B\u304c\u51fa\u308b\u56de\u6570\u3092\u5168\u4f53\u306e\u8a66\u884c\u56de\u6570\u3067\u5272\u3063\u3066\u3084\u308c\u3070\u6700\u521d\u306e\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3067\u6c42\u3081\u305f\u7d50\u679c(0.4285714285714286)\u306b\u8fd1\u3065\u304f\u306f\u305a\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3084\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p>100\u56de\u8a66\u884c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; highlight: [10]; title: ; notranslate\" title=\"\">\ncount = 0\niternum = 100\nfor i in range(0,iternum):\n    num = random.randint(0, 34)\n    result = data_it_ri&#x5B;&#039;\u79d1&#039;]&#x5B;num]\n    if result == &#039;B&#039;:\n        count += 1\nprint(count\/iternum)\n***\n0.45\n<\/pre><\/div>\n\n\n<p>1000\u56de\u8a66\u884c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; highlight: [5]; title: ; notranslate\" title=\"\">\ncount = 0\niternum = 1000\n\u7565\n***\n0.443\n<\/pre><\/div>\n\n\n<p>10000\u56de\u8a66\u884c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; highlight: [5]; title: ; notranslate\" title=\"\">\ncount = 0\niternum = 10000\n\u7565\n***\n0.4333\n<\/pre><\/div>\n\n\n<p>100\u4e07\u56de\u8a66\u884c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; highlight: [5]; title: ; notranslate\" title=\"\">\ncount = 0\niternum = 1000000\n\u7565\n***\n0.428449\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p>100\u4e07\u56de\u8a66\u884c\u3057\u305f\u3089\u304b\u306a\u308a\u8fd1\u3057\u3044\u6570\u5b57\u304c\u51fa\u307e\u3057\u305f\u3002\u5f53\u305f\u308a\u524d\u3067\u3059\u304c\u3001\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u306e\u8a08\u7b97\u306f\u6b63\u3057\u3044\u3053\u3068\u304c\u5b9f\u611f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d9\u30a4\u30ba\u306e\u5b9a\u7406\u3068\u306f \u3042\u308b\u4e8b\u8c61\u306b\u3064\u3044\u3066\u3001\u305d\u306e\u539f\u56e0\u3068\u306a\u308b\u5019\u88dc\uff08\u4e92\u3044\u306b\u72ec\u7acb\uff09&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1218,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"https:\/\/obenkyolab.com\/?p=2023","footnotes":""},"categories":[7,6],"tags":[],"class_list":["post-2023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-6","ja"],"_links":{"self":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2023"}],"version-history":[{"count":22,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2023\/revisions"}],"predecessor-version":[{"id":2045,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/posts\/2023\/revisions\/2045"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=\/wp\/v2\/media\/1218"}],"wp:attachment":[{"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/obenkyolab.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}