{"id":421,"date":"2022-09-25T22:56:32","date_gmt":"2022-09-25T13:56:32","guid":{"rendered":"https:\/\/kashiiblog.com\/?p=421"},"modified":"2022-09-25T22:56:32","modified_gmt":"2022-09-25T13:56:32","slug":"python%e5%86%85%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a0%bc%e7%b4%8d%e3%83%bb%e6%a6%82%e8%a6%81%e7%a2%ba%e8%aa%8d%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/kashiiblog.com\/?p=421","title":{"rendered":"Python\u5185\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u30fb\u6982\u8981\u78ba\u8a8d\u3059\u308b"},"content":{"rendered":"<p><a href=\"https:\/\/kashiiblog.com\/?p=327\">\u74b0\u5883\u8a2d\u5b9a<\/a>\u304c\u7d42\u308f\u308a\u3001<a href=\"https:\/\/kashiiblog.com\/?p=411\">\u57fa\u790e\u7684\u306a\u4f7f\u7528\u65b9\u6cd5\u3092\u7406\u89e3<\/a>\u3057\u307e\u3057\u305f\u3002\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u6253\u3063\u3066\u3044\u304f\u3053\u3068\u3068\u3057\u307e\u3059\u3002\u308f\u305f\u3057\u306f\u672c\u3084\u307b\u304b\u306e\u6559\u6750\u3092\u898b\u3064\u3064\u3001\u8a18\u8f09\u3057\u3066\u3044\u308b\u306e\u3067\u66f8\u3044\u3066\u307f\u308b\u3068\u304d\u306b\u306f\u500b\u3005\u3067\u6559\u6750\u3092\u898b\u306a\u304c\u3089\u305d\u306e\u901a\u308a\u306b\u6253\u3064\u3068\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30c7\u30fc\u30bf\u306e\u6982\u8981\u3092\u78ba\u8a8d\u3059\u308b<\/h2>\n<h3>\u6700\u521d\u306b\u8a18\u8f09\u3059\u308b\u30b3\u30fc\u30c9<\/h3>\n<blockquote><p>import pandas as pd<br \/>\nimport numpy as np<br \/>\nfrom matplotlib import pyplot as plt<br \/>\n%matplotlib inline<\/p><\/blockquote>\n<p>\u308f\u305f\u3057\u306e\u52c9\u5f37\u3057\u305f\u6559\u6750\u3067\u306f\u304a\u307e\u3058\u306a\u3044\u3068\u8a00\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u78ba\u8a8d\u3057\u305f\u3068\u3053\u308d\u3001<\/p>\n<p>import matplotlib.pyplot as plot<\/p>\n<p>\u300cimport matplotlib.pyplot\u300d\u307e\u3067\u3067\u300cmatplotlib \u306e pyplot \u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u6301\u3063\u3066\u304d\u307e\u3059\u300d\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002python \u306e\u8a00\u8449\u3067\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c matplotlib \u3092\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u6301\u3063\u3066\u304d\u3066\u3044\u307e\u3059\u30022\u6bb5\u76ee\u306e<\/p>\n<p>import numpy as np<\/p>\n<p>\u3082\u540c\u69d8\u3067\u300cnumpy \u3068\u3044\u3046\u6a5f\u80fd\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u6301\u3063\u3066\u304d\u307e\u3059\u300d\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>3,4\u6bb5\u76ee\u306f\u30b0\u30e9\u30d5\u304c\u30a2\u30a6\u30c8\u30d7\u30c3\u30c8\u884c\u306b\u51fa\u529b\u3055\u308c\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002plt.show()\u306a\u3069\u3092\u8a18\u8f09\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u304c\u3001plt.show()\u3092\u7701\u7565\u3057\u3066\u3082\u30b0\u30e9\u30d5\u304c\u51fa\u529b\u3055\u308c\u308b\u305f\u3081\u3001\u4eca\u56de\u306f\u8a18\u8f09\u304c\u7701\u7565\u3055\u308c\u3066\u3044\u307e\u3059\uff08<a href=\"https:\/\/www.yutaka-note.com\/entry\/matplotlib_inline\">\u8a73\u7d30<\/a>\uff09\u3002<\/p>\n<h3><span style=\"font-weight: 400;\">\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3093\u3067\u4e2d\u8eab\u3092\u898b\u3066\u307f\u308b<\/span><\/h3>\n<p>\u307e\u305a\u306f\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\u304b\u3089\u59cb\u3081\u307e\u3057\u3087\u3046\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8a18\u8f09\u3057\u3001CSV\u5f62\u5f0f\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002\u8aad\u307f\u8fbc\u3080\u30d5\u30a1\u30a4\u30eb\u306fPython\u30b3\u30fc\u30c9\u3092\u6253\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3059\u308b\u5834\u6240\u306b\u4e00\u7dd2\u306b\u5165\u308c\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<blockquote><p><span style=\"font-weight: 400;\">A = pd.read_csv(&#8220;B.csv&#8221;)<\/span><\/p><\/blockquote>\n<ul>\n<li>A\u306f\u8aad\u307f\u8fbc\u3093\u3060\u5f8c\u306e\u540d\u524d<\/li>\n<li><span style=\"font-weight: 400;\">&#8220;B.csv&#8221;<\/span>\u306f\u8aad\u307f\u8fbc\u307f\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u540d(csv\u5f62\u5f0f)<\/li>\n<\/ul>\n<p>\u8aad\u307f\u8fbc\u307f\u304c\u3067\u304d\u305f\u3089\uff08\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u306a\u304b\u3063\u305f\u3089\uff09\u3001\u4eca\u5ea6\u306f\u6700\u521d\u306e5\u884c\u3060\u3051\u62bd\u51fa\u3057\u3066\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u3092\u78ba\u304b\u3081\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<blockquote><p><span style=\"font-weight: 400;\">A.head()<\/span><\/p><\/blockquote>\n<p>\u6b63\u3057\u304f\u53cd\u6620\u3055\u308c\u308b\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-422\" src=\"http:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/sRnXYrlpNxXVAUd1664112319_1664112417.png\" alt=\"\" width=\"512\" height=\"128\" srcset=\"https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/sRnXYrlpNxXVAUd1664112319_1664112417.png 512w, https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/sRnXYrlpNxXVAUd1664112319_1664112417-300x75.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/>\n<p>\u3061\u306a\u307f\u306btail\u3092\u4f7f\u7528\u3059\u308b\u3068\u6700\u5f8c\u304b\u3089\u4e94\u884c\u62bd\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3><span style=\"font-weight: 400;\">\u57fa\u672c\u7d71\u8a08\u91cf\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">\u6b21\u306b\u3056\u3063\u304f\u308a\u3057\u305f\u30c7\u30fc\u30bf\u306e\u50be\u5411\u3092\u898b\u308b\u305f\u3081\u306bdescribe\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002describe\u95a2\u6570\u306f\u7279\u306b\u5f15\u6570\u3092\u6307\u5b9a\u3057\u306a\u3044\u72b6\u614b\u3067\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u591a\u304f\u3001\u3068\u308a\u3042\u3048\u305a\u30c7\u30fc\u30bf\u306e\u6982\u8981\u3092\u628a\u63e1\u3059\u308b\u969b\u306b\u983b\u7e41\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/span><\/p>\n<blockquote><p><span style=\"font-weight: 400;\">A.describe()<\/span><\/p><\/blockquote>\n<p>\u5165\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u5185\u5bb9\u3067\u4e2d\u8eab\u304c\u5909\u308f\u308a\u307e\u3059\u3002\u4eca\u56de\u306f\u6570\u5024\u30c7\u30fc\u30bf\u3092\u5165\u308c\u3066\u3044\u308b\u306e\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304c\u51fa\u307e\u3059\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-423\" src=\"http:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/gxl4XiMSbWp89KT1664112642_1664112658.png\" alt=\"\" width=\"407\" height=\"241\" srcset=\"https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/gxl4XiMSbWp89KT1664112642_1664112658.png 407w, https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/gxl4XiMSbWp89KT1664112642_1664112658-300x178.png 300w\" sizes=\"auto, (max-width: 407px) 100vw, 407px\" \/>\n<table>\n<tbody>\n<tr>\n<td><strong>\u8868\u793a\u540d<\/strong><\/td>\n<td><strong>\u8aac\u660e<\/strong><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">count<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u30c7\u30fc\u30bf\u306e\u500b\u6570\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">mean<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u6570\u5024\u30c7\u30fc\u30bf\u306e\u5e73\u5747\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">std<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u6570\u5024\u30c7\u30fc\u30bf\u306e\u6a19\u6e96\u504f\u5dee\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">min<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u6700\u5c0f\u5024\u3092\u8868\u3057\u307e\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">max<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u6700\u5927\u5024\u3092\u8868\u3057\u307e\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">25%,50%,75%<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u56db\u5206\u4f4d\u6570\u3092\u8868\u3057\u307e\u3059<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u307b\u304b\u306b\u3082\u30c7\u30fc\u30bf\u306b\u3088\u3063\u3066\u8868\u793a\u3055\u308c\u308b\u3082\u306e\u304c\u9055\u3046\u306e\u3067\u3061\u3087\u3063\u3068\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h4>\u30ab\u30c6\u30b4\u30ea\u30ab\u30eb\u30c7\u30fc\u30bf(\u30aa\u30d6\u30b8\u30a7\u30af\u30c8)<\/h4>\n<table>\n<tbody>\n<tr>\n<td><strong>\u8868\u793a\u540d<\/strong><\/td>\n<td><strong>\u8aac\u660e<\/strong><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">count<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u30c7\u30fc\u30bf\u306e\u500b\u6570\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">unique<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u30e6\u30cb\u30fc\u30af\u306a\u5024\u304c\u3044\u304f\u3064\u5b58\u5728\u3059\u308b\u304b\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">top<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\u6700\u3082\u591a\u304f\u51fa\u73fe\u3057\u305f\u8981\u7d20\u306e\u5024\u3092\u8868\u3059(\u6700\u983b\u5024)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">freq<\/span><\/td>\n<td><span style=\"font-weight: 400;\">top\u3067\u8fd4\u3055\u308c\u305f\u5024\u306e\u51fa\u73fe\u56de\u6570\u3092\u8868\u3059<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h4>\u5f15\u6570percentiles\u3067\u5206\u4f4d\u6570\u6307\u5b9a<\/h4>\n<p>\u307e\u305f\u3001\u5148\u307b\u3069\u306f<span style=\"font-weight: 400;\">25%,50%,75%\u3067\u3057\u305f\u304c\u3001\u5206\u4f4d\u6570\u6307\u5b9a\u306f\u5909\u66f4\u3067\u304d\u307e\u3059\u3002<\/span><\/p>\n<p>0~1\u306e\u9593\u3067\u3069\u306e\u5206\u4f4d\u6570\u3092\u898b\u305f\u3044\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002 \u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f[0.25,0.5,0.75]\u306e3\u3064\u306e\u5024\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3044\u304f\u3064\u8a2d\u5b9a\u3057\u3066\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<blockquote><p>In []: s.describe() # \u7279\u306bpercentiles\u3092\u6307\u5b9a\u3057\u306a\u3044\u72b6\u614b<br \/>\nOut[]:<\/p>\n<p>In []: s.describe(percentiles=[0.1,0.2,0.5]) # 10%,20%,50%<br \/>\nOut[]:<\/p>\n<p>In []: s.describe(percentiles=[0.1,0.2,0.5,0.89]) # 4\u3064\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd<br \/>\nOut[]:<\/p>\n<p>In []: s.describe(percentiles=[0,0.2,0.99]) # 0\u306b\u3059\u308b\u3068\u6700\u5c0f\u5024\u3068\u4e00\u81f4\u3059\u308b\u30021\u306a\u3089\u6700\u5927\u5024<br \/>\nOut[]:<\/p><\/blockquote>\n<h3><span style=\"font-weight: 400;\">\u8a73\u7d30\u306a\u30c7\u30fc\u30bf\u3092\u78ba\u8a8d\u3059\u308b<\/span><\/h3>\n<p>info\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u30c7\u30fc\u30bf\u306e\u5927\u307e\u304b\u306a\u60c5\u5831\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u7279\u306b\u300c\u30c7\u30fc\u30bf\u304c\u6b20\u640d\u3057\u3066\u3044\u306a\u3044\u6570\u300d\u3068\u300c\u30c7\u30fc\u30bf\u578b\u300d\u3092\u4e00\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304c\u5229\u70b9\u3067\u3059\u3002\u30c7\u30fc\u30bf\u578b\u306b\u3088\u3063\u3066\u4eca\u5f8c\u306e\u5206\u6790\u3092\u3059\u308b\u969b\u306b\u4f7f\u7528\u3067\u304d\u308b\u95a2\u6570\u304c\u5909\u308f\u3063\u3066\u304d\u305f\u308a\u3001\u8a08\u7b97\u304c\u3067\u304d\u306a\u3044\u5834\u5408\u304c\u3042\u308b\u305f\u3081\u78ba\u8a8d\u3067\u304d\u308b\u306e\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<blockquote><p><span style=\"font-weight: 400;\">A.info()<\/span><\/p><\/blockquote>\n<p>\u3053\u3093\u306a\u5f62\u3067\u62bd\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-424\" src=\"http:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/ZFsUaospzuYONdd1664113945_1664113975.png\" alt=\"\" width=\"321\" height=\"331\" srcset=\"https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/ZFsUaospzuYONdd1664113945_1664113975.png 321w, https:\/\/kashiiblog.com\/wp-content\/uploads\/2022\/09\/ZFsUaospzuYONdd1664113945_1664113975-291x300.png 291w\" sizes=\"auto, (max-width: 321px) 100vw, 321px\" \/>\n<p>\u30c7\u30fc\u30bf\u6982\u8981\u304c\u78ba\u8a8d\u3067\u304d\u305f\u306e\u3067\u3053\u306e\u3042\u3068\u306f\u7d30\u304b\u304f\u5206\u6790\u3084\u30c7\u30fc\u30bf\u306e\u53ef\u8996\u5316\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883\u8a2d\u5b9a\u304c\u7d42\u308f\u308a\u3001\u57fa\u790e\u7684\u306a\u4f7f\u7528\u65b9\u6cd5\u3092\u7406\u89e3\u3057\u307e\u3057\u305f\u3002\u5b9f\u969b\u306b\u30b3\u30fc\u30c9\u3092\u6253\u3063\u3066\u3044\u304f\u3053\u3068\u3068\u3057\u307e\u3059\u3002\u308f\u305f\u3057\u306f\u672c\u3084\u307b\u304b\u306e\u6559\u6750\u3092\u898b\u3064\u3064\u3001\u8a18\u8f09\u3057\u3066\u3044\u308b\u306e\u3067\u66f8\u3044\u3066\u307f\u308b\u3068\u304d\u306b\u306f\u500b\u3005\u3067\u6559\u6750\u3092\u898b\u306a\u304c\u3089\u305d\u306e\u901a\u308a\u306b\u6253\u3064\u3068\u3088\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u30c7\u30fc\u30bf\u306e\u6982\u8981&#8230;<\/p>\n","protected":false},"author":1,"featured_media":418,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[22],"tags":[23],"class_list":["post-421","post","type-post","status-publish","format-standard","has-post-thumbnail","category-python","tag-python","article cf"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/posts\/421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=421"}],"version-history":[{"count":1,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions"}],"predecessor-version":[{"id":425,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions\/425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=\/wp\/v2\/media\/418"}],"wp:attachment":[{"href":"https:\/\/kashiiblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kashiiblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}