{"id":23,"date":"2024-05-29T14:40:08","date_gmt":"2024-05-29T05:40:08","guid":{"rendered":"https:\/\/blog.hy2t.com\/?p=23"},"modified":"2024-07-02T02:44:30","modified_gmt":"2024-07-01T17:44:30","slug":"pyenv-%e3%81%a8pandas%e3%82%92%e4%bd%bf%e3%81%84%e3%80%81%e3%83%ad%e3%83%bc%e3%82%ab%e3%83%ab%e3%81%aecsv%e3%82%92%e8%aa%ad%e3%81%bf%e5%8f%96%e3%82%8a%e3%81%a7%e3%81%8d%e3%82%8b%e3%82%88%e3%81%86","status":"publish","type":"post","link":"https:\/\/hy2t.com\/?p=23","title":{"rendered":"pyenv \u3068pandas\u3092\u4f7f\u3044\u3001\u30ed\u30fc\u30ab\u30eb\u306eCSV\u3092\u8aad\u307f\u53d6\u308a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"601\" height=\"203\" src=\"https:\/\/hy2t.com\/wp-content\/uploads\/2024\/06\/python-logo-master.png\" alt=\"Python\u30ed\u30b4\" class=\"wp-image-71\" srcset=\"https:\/\/hy2t.com\/wp-content\/uploads\/2024\/06\/python-logo-master.png 601w, https:\/\/hy2t.com\/wp-content\/uploads\/2024\/06\/python-logo-master-300x101.png 300w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">mac\u3067pandas\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u306e\u624b\u9806<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">python\u306f\u5207\u308a\u66ff\u3048\u3089\u308c\u308b\u3088\u3046\u306b<a href=\"https:\/\/github.com\/pyenv\/pyenv\" target=\"_blank\" rel=\"noopener\" title=\"pyenv\">pyenv<\/a>\u3082\u5c0e\u5165\u3059\u308b<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-8e8f1e96a2553c55003861ff57dd3639\"><code>brew install pyenv\n\n\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u6700\u65b0\u3092\u6301\u3063\u3066\u304f\u308b\npyenv install --version\n\npyenv install 3.12.3\n\n=&gt; ModuleNotFoundError: No module named '\\_tkinter'\n# linter \u304c\u306a\u3044\u3089\u3057\u3044\n\n=&gt; brew install python-tk\n# xcode \u3082\u306a\u3044\u3089\u3057\u3044\n=&gt; xcode-select --install\n# OK\n\npip install pandas<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8aad\u307f\u53d6\u308b\u30c7\u30fc\u30bf\u306f<a href=\"https:\/\/blog.hy2t.com\/?p=15\" target=\"_blank\" rel=\"noopener\" title=\"\u524d\u56de\u306e\u30c7\u30fc\u30bf\">\u524d\u56de\u306e\u30c7\u30fc\u30bf<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u7d42\u7684\u306b\u306f\u2193\u30b3\u30fc\u30c9\u3067\u8aad\u307f\u53d6\u308c\u307e\u3057\u305f<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-078951ac61d486d0fbeeef7327dad690\"><code>import pandas as pd\n\ndf = pd.read_csv('.\/age0501.csv',encoding='shift_jis', skiprows=1, skipfooter=2, engine='python')\n\ncleaned_df =  df&#91;df&#91;'\u5e74\u9f62'] != '\u5c0f\u8a08']\n\nprint(cleaned_df&#91;'\u7537'].replace(',', '', regex=True).astype(int).median())<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u8a18\u306f\u8abf\u3079\u305f\u3068\u3053\u308d<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SJIS\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3080\u306e\u306b\u3001encoding=&#8217;shift_jis&#8217;\u3092\u6307\u5b9a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8aad\u307f\u53d6\u308a\u305f\u304f\u306a\u3044\u884c\u306fskiprows\u3068skipfooter\u3067\u6307\u5b9a <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5e74\u4ee3\u3054\u3068\u306b\u5c0f\u8a08\u304c\u3042\u308a\u3001\u8aad\u307e\u306a\u3044\u3088\u3046\u306b\u3059\u308b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u30b7\u30f3\u30b0\u30eb\u30af\u30aa\u30fc\u30c8\u304c\u5165\u3063\u3066\u3001\u6587\u5b57\u6271\u3044\u306b\u306a\u3063\u3066\u3044\u305f\u305f\u3081\u3001replace\u3067&#8217;\u3092\u7f6e\u63db\u3057\u305f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mac\u3067pandas\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u306e\u624b\u9806 python\u306f\u5207\u308a\u66ff\u3048\u3089\u308c\u308b\u3088\u3046\u306bpyenv\u3082\u5c0e\u5165\u3059\u308b \u8aad\u307f\u53d6\u308b\u30c7\u30fc\u30bf\u306f\u524d\u56de\u306e\u30c7\u30fc\u30bf \u6700\u7d42\u7684\u306b\u306f\u2193\u30b3\u30fc\u30c9\u3067\u8aad\u307f\u53d6\u308c\u307e\u3057\u305f \u4e0b\u8a18\u306f\u8abf\u3079\u305f\u3068\u3053\u308d SJIS\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3080\u306e\u306b\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":71,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[12],"tags":[10],"class_list":["post-23","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-12","tag-python"],"_links":{"self":[{"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hy2t.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":2,"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions\/73"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hy2t.com\/index.php?rest_route=\/wp\/v2\/media\/71"}],"wp:attachment":[{"href":"https:\/\/hy2t.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hy2t.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hy2t.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}