Skip to content

Instantly share code, notes, and snippets.

@emesday
Last active August 6, 2018 07:37
Show Gist options
  • Save emesday/3af8a5e7e5d3fb368a2f22da82b12d64 to your computer and use it in GitHub Desktop.
Save emesday/3af8a5e7e5d3fb368a2f22da82b12d64 to your computer and use it in GitHub Desktop.
통계청 지역 정보
# http://kssc.kostat.go.kr/ksscNew_web/kssc/common/CommonBoardList.do?gubun=1&strCategoryNameCode=019&strBbsId=kascrr&categoryMenu=014
import pandas as pd
input = pd.ExcelFile("한국행정구역분류_2018.7.1.기준_최종.xls")
sheet = input.parse(4, 1)
sheet.to_csv("loc.csv")
sheet["label"] = sheet["시도"] + "_" + sheet["시군구"]
sheet["text"] = sheet["시도"] + " " + sheet["시군구"] + " " + sheet["행정구역명"] + " " + sheet["행정동"] + " " + sheet["법정동"]
data = sheet.loc[~(sheet["시도"] == sheet["시군구"])][["label", "text"]]
data.to_csv("loc.tsv", sep='\t', header=False, index=False, encoding="utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment