{"id":675,"date":"2023-04-18T12:31:21","date_gmt":"2023-04-18T03:31:21","guid":{"rendered":"https:\/\/blog.dozzing.kr\/?p=675"},"modified":"2025-10-24T11:40:19","modified_gmt":"2025-10-24T02:40:19","slug":"python-csv-%ed%8c%8c%ec%9d%bc-%ec%9d%b8%ec%bd%94%eb%94%a9-%ed%99%95%ec%9d%b8-%eb%b0%8f-%eb%b3%80%ea%b2%bd%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/blog.dozzing.kr\/?p=675","title":{"rendered":"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30"},"content":{"rendered":"<h2>\ud83d\udcab CSV \ud30c\uc77c \uc778\ucf54\ub529 \uc815\ubcf4 \ud655\uc778\ud558\uae30<\/h2>\n<ul>\n<li>chardet \ub77c\uc774\ube0c\ub7ec\ub9ac \uc124\uce58<\/li>\n<\/ul>\n<pre><code class=\"line-numbers\">pip install chardet\n<\/code><\/pre>\n<ul>\n<li>Python \ucf54\ub4dc<\/li>\n<\/ul>\n<pre><code class=\"language-Python line-numbers\">import chardet\n\n# \ud30c\uc77c \uacbd\ub85c\nfile_path = '1.csv'\n\n# \ud30c\uc77c \uc5f4\uae30 (\ubc14\uc774\ub108\ub9ac \ubaa8\ub4dc)\nwith open(file_path, 'rb') as f:\n    # \ud30c\uc77c \ub0b4\uc6a9 \uc77d\uae30\n    content = f.read()\n\n# \ud30c\uc77c \ub0b4\uc6a9\uc758 \uc778\ucf54\ub529 \ucd94\uc815\nresult = chardet.detect(content)\n\n# \ucd94\uc815\ub41c \uc778\ucf54\ub529 \ucd9c\ub825\nprint(\"\ud30c\uc77c\uc758 \uc778\ucf54\ub529:\", result['encoding'])\n<\/code><\/pre>\n<p>\u00a0<\/p>\n<h2>\ud83d\udcab CSV \ud30c\uc77c \uc778\ucf54\ub529 \uc815\ubcf4 \ubcc0\uacbd\ud558\uae30<\/h2>\n<ul>\n<li>Python \ucf54\ub4dc<\/li>\n<\/ul>\n<pre><code class=\"language-Python line-numbers\">import pandas as pd\n\n# \uc6d0\ubcf8 CSV \ud30c\uc77c\uba85\ninput_file = '1.csv'\n\n# \ubcc0\uacbd\ub41c CSV \ud30c\uc77c\uba85\noutput_file = '2.csv'\n\n# CSV \ud30c\uc77c \uc77d\uae30 (UTF-8 \uc778\ucf54\ub529\uc73c\ub85c \uac00\uc815)\ndf = pd.read_csv(input_file)\n\n# \ub370\uc774\ud130\ud504\ub808\uc784\uc744 EUC-KR \uc778\ucf54\ub529\uc73c\ub85c \ubcc0\ud658\ud558\uc5ec \uc800\uc7a5\ndf.to_csv(output_file, encoding='euc-kr', index=False)\n\nprint(\"\ud30c\uc77c\uc774 \uc131\uacf5\uc801\uc73c\ub85c \uc800\uc7a5\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\")\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udcab CSV \ud30c\uc77c \uc778\ucf54\ub529 \uc815\ubcf4 \ud655\uc778\ud558\uae30 chardet \ub77c\uc774\ube0c\ub7ec\ub9ac \uc124\uce58 pip install chardet Python \ucf54\ub4dc import chardet # \ud30c\uc77c \uacbd\ub85c file_path = &#8216;1.csv&#8217; # \ud30c\uc77c \uc5f4\uae30 (\ubc14\uc774\ub108\ub9ac \ubaa8\ub4dc) with open(file_path, &#8216;rb&#8217;) as f: # \ud30c\uc77c \ub0b4\uc6a9 \uc77d\uae30 content = f.read() # \ud30c\uc77c \ub0b4\uc6a9\uc758 \uc778\ucf54\ub529 \ucd94\uc815 result = chardet.detect(content) # \ucd94\uc815\ub41c \uc778\ucf54\ub529 \ucd9c\ub825 print(&#8220;\ud30c\uc77c\uc758 \uc778\ucf54\ub529:&#8221;, result[&#8216;encoding&#8217;]) \u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,49],"tags":[44,43,42],"class_list":["post-675","post","type-post","status-publish","format-standard","hentry","category-python","category-system-development","tag-csv","tag-encoding","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.dozzing.kr\/?p=675\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World\" \/>\n<meta property=\"og:description\" content=\"\ud83d\udcab CSV \ud30c\uc77c \uc778\ucf54\ub529 \uc815\ubcf4 \ud655\uc778\ud558\uae30 chardet \ub77c\uc774\ube0c\ub7ec\ub9ac \uc124\uce58 pip install chardet Python \ucf54\ub4dc import chardet # \ud30c\uc77c \uacbd\ub85c file_path = &#039;1.csv&#039; # \ud30c\uc77c \uc5f4\uae30 (\ubc14\uc774\ub108\ub9ac \ubaa8\ub4dc) with open(file_path, &#039;rb&#039;) as f: # \ud30c\uc77c \ub0b4\uc6a9 \uc77d\uae30 content = f.read() # \ud30c\uc77c \ub0b4\uc6a9\uc758 \uc778\ucf54\ub529 \ucd94\uc815 result = chardet.detect(content) # \ucd94\uc815\ub41c \uc778\ucf54\ub529 \ucd9c\ub825 print(&quot;\ud30c\uc77c\uc758 \uc778\ucf54\ub529:&quot;, result[&#039;encoding&#039;]) \u00a0 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.dozzing.kr\/?p=675\" \/>\n<meta property=\"og:site_name\" content=\"Dozzing World\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-18T03:31:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-24T02:40:19+00:00\" \/>\n<meta name=\"author\" content=\"Dozzing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dozzing\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.dozzing.kr\/?p=675\",\"url\":\"https:\/\/blog.dozzing.kr\/?p=675\",\"name\":\"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World\",\"isPartOf\":{\"@id\":\"https:\/\/blog.dozzing.kr\/#website\"},\"datePublished\":\"2023-04-18T03:31:21+00:00\",\"dateModified\":\"2025-10-24T02:40:19+00:00\",\"author\":{\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.dozzing.kr\/?p=675#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.dozzing.kr\/?p=675\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.dozzing.kr\/?p=675#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.dozzing.kr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.dozzing.kr\/#website\",\"url\":\"https:\/\/blog.dozzing.kr\/\",\"name\":\"Dozzing World\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.dozzing.kr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f\",\"name\":\"Dozzing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/blog.dozzing.kr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g\",\"caption\":\"Dozzing\"},\"sameAs\":[\"https:\/\/blog.dozzing.kr\/\"],\"url\":\"https:\/\/blog.dozzing.kr\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.dozzing.kr\/?p=675","og_locale":"ko_KR","og_type":"article","og_title":"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World","og_description":"\ud83d\udcab CSV \ud30c\uc77c \uc778\ucf54\ub529 \uc815\ubcf4 \ud655\uc778\ud558\uae30 chardet \ub77c\uc774\ube0c\ub7ec\ub9ac \uc124\uce58 pip install chardet Python \ucf54\ub4dc import chardet # \ud30c\uc77c \uacbd\ub85c file_path = '1.csv' # \ud30c\uc77c \uc5f4\uae30 (\ubc14\uc774\ub108\ub9ac \ubaa8\ub4dc) with open(file_path, 'rb') as f: # \ud30c\uc77c \ub0b4\uc6a9 \uc77d\uae30 content = f.read() # \ud30c\uc77c \ub0b4\uc6a9\uc758 \uc778\ucf54\ub529 \ucd94\uc815 result = chardet.detect(content) # \ucd94\uc815\ub41c \uc778\ucf54\ub529 \ucd9c\ub825 print(\"\ud30c\uc77c\uc758 \uc778\ucf54\ub529:\", result['encoding']) \u00a0 [&hellip;]","og_url":"https:\/\/blog.dozzing.kr\/?p=675","og_site_name":"Dozzing World","article_published_time":"2023-04-18T03:31:21+00:00","article_modified_time":"2025-10-24T02:40:19+00:00","author":"Dozzing","twitter_card":"summary_large_image","twitter_misc":{"\uae00\uc4f4\uc774":"Dozzing","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.dozzing.kr\/?p=675","url":"https:\/\/blog.dozzing.kr\/?p=675","name":"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30 - Dozzing World","isPartOf":{"@id":"https:\/\/blog.dozzing.kr\/#website"},"datePublished":"2023-04-18T03:31:21+00:00","dateModified":"2025-10-24T02:40:19+00:00","author":{"@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f"},"breadcrumb":{"@id":"https:\/\/blog.dozzing.kr\/?p=675#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.dozzing.kr\/?p=675"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.dozzing.kr\/?p=675#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.dozzing.kr\/"},{"@type":"ListItem","position":2,"name":"[Python] csv \ud30c\uc77c \uc778\ucf54\ub529 \ud655\uc778 \ubc0f \ubcc0\uacbd\ud558\uae30"}]},{"@type":"WebSite","@id":"https:\/\/blog.dozzing.kr\/#website","url":"https:\/\/blog.dozzing.kr\/","name":"Dozzing World","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.dozzing.kr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Person","@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/52258baef65b530d3e867e4c1f79c36f","name":"Dozzing","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/blog.dozzing.kr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0bbe3fe675c3641965411ffb61a1368b3bf05e794deaa3c7bd0ef7b4690a614a?s=96&d=mm&r=g","caption":"Dozzing"},"sameAs":["https:\/\/blog.dozzing.kr\/"],"url":"https:\/\/blog.dozzing.kr\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=675"}],"version-history":[{"count":2,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/675\/revisions"}],"predecessor-version":[{"id":678,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=\/wp\/v2\/posts\/675\/revisions\/678"}],"wp:attachment":[{"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.dozzing.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}