Skip to content

sunghwan87/PublicDataReader

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PublicDataReader

Hits Linkedin Badge

PNG

PublicDataReader๋Š” ๊ณต๊ณต๋ฐ์ดํ„ฐํฌํ„ธ, ์„œ์šธ ์—ด๋ฆฐ๋ฐ์ดํ„ฐ ๊ด‘์žฅ ๋“ฑ ๊ธฐ๊ด€์—์„œ ์ œ๊ณตํ•˜๊ณ  ์žˆ๋Š” ๋ฐ์ดํ„ฐ ๊ด€๋ จ OpenAPI ์„œ๋น„์Šค๋ฅผ Python์œผ๋กœ ์‰ฝ๊ฒŒ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ๋ฐ์ดํ„ฐ ์กฐํšŒ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค.

2021๋…„ 11์›” ํ˜„์žฌ ์•„๋ž˜ OpenAPI ์„œ๋น„์Šค ๊ฐ๊ฐ์— ๋Œ€ํ•ด ๋ฐ์ดํ„ฐ๋ฅผ Pandas DataFrame ํ˜•ํƒœ๋กœ ์กฐํšŒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์•„๋ž˜ ์„œ๋น„์Šค์— ๋Œ€ํ•œ OpenAPI ํ™œ์šฉ์‹ ์ฒญ์„ ๋ฐ˜๋“œ์‹œ ์™„๋ฃŒํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ ์„œ๋น„์Šค ๋ชฉ๋ก

1) ๊ตญํ† ๊ตํ†ต๋ถ€ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

์„œ๋น„์Šค๋ช… ์ƒํ’ˆ์œ ํ˜• ๊ฑฐ๋ž˜์œ ํ˜•
์•„ํŒŒํŠธ๋งค๋งค ์‹ค๊ฑฐ๋ž˜ ์ƒ์„ธ ์ž๋ฃŒ ์กฐํšŒ ์•„ํŒŒํŠธ ๋งค๋งค
์•„ํŒŒํŠธ ์ „์›”์„ธ ์ž๋ฃŒ ์กฐํšŒ ์•„ํŒŒํŠธ ์ „์›”์„ธ
์•„ํŒŒํŠธ ๋ถ„์–‘๊ถŒ์ „๋งค ์‹ ๊ณ  ์ž๋ฃŒ ์กฐํšŒ ๋ถ„์–‘์ž…์ฃผ๊ถŒ ๋งค๋งค
์˜คํ”ผ์Šคํ…” ๋งค๋งค ์‹ ๊ณ  ์กฐํšŒ ์˜คํ”ผ์Šคํ…” ๋งค๋งค
์˜คํ”ผ์Šคํ…” ์ „์›”์„ธ ์‹ ๊ณ  ์กฐํšŒ ์˜คํ”ผ์Šคํ…” ์ „์›”์„ธ
์—ฐ๋ฆฝ๋‹ค์„ธ๋Œ€ ๋งค๋งค ์‹ค๊ฑฐ๋ž˜์ž๋ฃŒ ์กฐํšŒ ์—ฐ๋ฆฝ๋‹ค์„ธ๋Œ€ ๋งค๋งค
์—ฐ๋ฆฝ๋‹ค์„ธ๋Œ€ ์ „์›”์„ธ ์‹ค๊ฑฐ๋ž˜์ž๋ฃŒ ์กฐํšŒ ์—ฐ๋ฆฝ๋‹ค์„ธ๋Œ€ ์ „์›”์„ธ
๋‹จ๋…/๋‹ค๊ฐ€๊ตฌ ๋งค๋งค ์‹ค๊ฑฐ๋ž˜ ์กฐํšŒ ๋‹จ๋…๋‹ค๊ฐ€๊ตฌ ๋งค๋งค
๋‹จ๋…/๋‹ค๊ฐ€๊ตฌ ์ „์›”์„ธ ์ž๋ฃŒ ์กฐํšŒ ๋‹จ๋…๋‹ค๊ฐ€๊ตฌ ์ „์›”์„ธ
ํ† ์ง€ ๋งค๋งค ์‹ ๊ณ  ์กฐํšŒ ํ† ์ง€ ๋งค๋งค
์ƒ์—…์—…๋ฌด์šฉ ๋ถ€๋™์‚ฐ ๋งค๋งค ์‹ ๊ณ  ์ž๋ฃŒ ์กฐํšŒ ์ƒ์—…์—…๋ฌด์šฉ ๋งค๋งค

2) ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ์ •๋ณด ์„œ๋น„์Šค

์„œ๋น„์Šค๋ช… ์นดํ…Œ๊ณ ๋ฆฌ๋ช…
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ๊ธฐ๋ณธ๊ฐœ์š” ์กฐํšŒ ๊ธฐ๋ณธ๊ฐœ์š”
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ด๊ด„ํ‘œ์ œ๋ถ€ ์กฐํšŒ ์ด๊ด„ํ‘œ์ œ๋ถ€
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ํ‘œ์ œ๋ถ€ ์กฐํšŒ ํ‘œ์ œ๋ถ€
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ธต๋ณ„๊ฐœ์š” ์กฐํšŒ ์ธต๋ณ„๊ฐœ์š”
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ๋ถ€์†์ง€๋ฒˆ ์กฐํšŒ ๋ถ€์†์ง€๋ฒˆ
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ „์œ ๊ณต์šฉ๋ฉด์  ์กฐํšŒ ์ „์œ ๊ณต์šฉ๋ฉด์ 
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์˜ค์ˆ˜์ •ํ™”์‹œ์„ค ์กฐํšŒ ์˜ค์ˆ˜์ •ํ™”์‹œ์„ค
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ฃผํƒ๊ฐ€๊ฒฉ ์กฐํšŒ ์ฃผํƒ๊ฐ€๊ฒฉ
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ „์œ ๋ถ€ ์กฐํšŒ ์ „์œ ๋ถ€
๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ง€์—ญ์ง€๊ตฌ๊ตฌ์—ญ ์กฐํšŒ ์ง€์—ญ์ง€๊ตฌ๊ตฌ์—ญ

3) ์†Œ์ƒ๊ณต์ธ ์ƒ๊ฐ€์—…์†Œ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

์„œ๋น„์Šค๋ช… ์นดํ…Œ๊ณ ๋ฆฌ๋ช…
์ง€์ • ์ƒ๊ถŒ์กฐํšŒ ์ง€์ •์ƒ๊ถŒ
๋ฐ˜๊ฒฝ๋‚ด ์ƒ๊ถŒ์กฐํšŒ ๋ฐ˜๊ฒฝ์ƒ๊ถŒ
์‚ฌ๊ฐํ˜•๋‚ด ์ƒ๊ถŒ์กฐํšŒ ์‚ฌ๊ฐํ˜•์ƒ๊ถŒ
ํ–‰์ •๊ตฌ์—ญ ๋‹จ์œ„ ์ƒ๊ถŒ์กฐํšŒ ํ–‰์ •๊ตฌ์—ญ์ƒ๊ถŒ
๋‹จ์ผ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ๋‹จ์ผ์ƒ๊ฐ€
๊ฑด๋ฌผ๋‹จ์œ„ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ๊ฑด๋ฌผ์ƒ๊ฐ€
์ง€๋ฒˆ๋‹จ์œ„ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ์ง€๋ฒˆ์ƒ๊ฐ€
ํ–‰์ •๋™ ๋‹จ์œ„ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ํ–‰์ •๋™์ƒ๊ฐ€
์ƒ๊ถŒ๋‚ด ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ์ƒ๊ถŒ์ƒ๊ฐ€
๋ฐ˜๊ฒฝ๋‚ด ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ๋ฐ˜๊ฒฝ์ƒ๊ฐ€
์‚ฌ๊ฐํ˜•๋‚ด ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ์‚ฌ๊ฐํ˜•์ƒ๊ฐ€
๋‹ค๊ฐํ˜•๋‚ด ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ๋‹ค๊ฐํ˜•์ƒ๊ฐ€
์—…์ข…๋ณ„ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ์—…์ข…๋ณ„์ƒ๊ฐ€
์ˆ˜์ •์ผ์ž๊ธฐ์ค€ ์ƒ๊ฐ€์—…์†Œ ์กฐํšŒ ์ˆ˜์ •์ผ์ž์ƒ๊ฐ€
์ƒ๊ถŒ์ •๋ณด ์—…์ข… ๋Œ€๋ถ„๋ฅ˜ ์กฐํšŒ ์—…์ข…๋Œ€๋ถ„๋ฅ˜
์ƒ๊ถŒ์ •๋ณด ์—…์ข… ์ค‘๋ถ„๋ฅ˜ ์กฐํšŒ ์—…์ข…์ค‘๋ถ„๋ฅ˜
์ƒ๊ถŒ์ •๋ณด ์—…์ข… ์†Œ๋ถ„๋ฅ˜ ์กฐํšŒ ์—…์ข…์†Œ๋ถ„๋ฅ˜

์„œ์šธ ์—ด๋ฆฐ๋ฐ์ดํ„ฐ ๊ด‘์žฅ ์„œ๋น„์Šค ๋ชฉ๋ก

1) ์„œ์šธ์‹œ ๊ตํ†ต ๊ด€๋ จ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

์„œ๋น„์Šค๋ช… ์นดํ…Œ๊ณ ๋ฆฌ๋ช…
์„œ์šธ์‹œ ์ง€ํ•˜์ฒ ํ˜ธ์„ ๋ณ„ ์—ญ๋ณ„ ์Šนํ•˜์ฐจ ์ธ์› ์ •๋ณด ์ง€ํ•˜์ฒ ์Šนํ•˜์ฐจ
์„œ์šธ์‹œ ๋ฒ„์Šค๋…ธ์„ ๋ณ„ ์ •๋ฅ˜์žฅ๋ณ„ ์Šนํ•˜์ฐจ ์ธ์› ์ •๋ณด ๋ฒ„์Šค์Šนํ•˜์ฐจ

Installation

pip install --upgrade PublicDataReader

Dependency

pip install pandas==1.3.4
pip install requests==2.26.0
pip install beautifulsoup4==4.10.0

Quick Start

๊ตญํ† ๊ตํ†ต๋ถ€ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

# 1. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž„ํฌํŠธํ•˜๊ธฐ
import PublicDataReader as pdr
print(pdr.__version__)
print(pdr.__info__)

# 2. ๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ OpenAPI ์„œ๋น„์Šค ์ธ์ฆํ‚ค ์ž…๋ ฅํ•˜๊ธฐ
serviceKey = "๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ์„œ๋น„์Šค ํ‚ค"

# 3. ๊ตญํ† ๊ตํ†ต๋ถ€ ์‹ค๊ฑฐ๋ž˜๊ฐ€ ์ •๋ณด ์กฐํšŒ OpenAPI ์„ธ์…˜ ์ •์˜ํ•˜๊ธฐ
# debug: True์ด๋ฉด ๋ชจ๋“  ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ, False์ด๋ฉด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋งŒ ์ถœ๋ ฅ (๊ธฐ๋ณธ๊ฐ’: False)
ts = pdr.Transaction(serviceKey, debug=True)

# 4. ์ง€์—ญ์ฝ”๋“œ(์‹œ๊ตฐ๊ตฌ์ฝ”๋“œ) ๊ฒ€์ƒ‰ํ•˜๊ธฐ
sigunguName = "๋ถ„๋‹น๊ตฌ"                                  # ์‹œ๊ตฐ๊ตฌ์ฝ”๋“œ: 41135
code = pdr.code_list()
code.loc[(code['์‹œ๊ตฐ๊ตฌ๋ช…'].str.contains(sigunguName, na=False)) &
         (code['์๋ฉด๋™๋ช…'].isna())]

# 5. ์ง€์—ญ, ์›” ๋ณ„ ๋ฐ์ดํ„ฐ ํ”„๋ ˆ์ž„ ๋งŒ๋“ค๊ธฐ
prod="์•„ํŒŒํŠธ"                                           # ๋ถ€๋™์‚ฐ ์ƒํ’ˆ ์ข…๋ฅ˜ (ex. ์•„ํŒŒํŠธ, ์˜คํ”ผ์Šคํ…”, ๋‹จ๋…๋‹ค๊ฐ€๊ตฌ ๋“ฑ)
trans="๋งค๋งค"                                            # ๋ถ€๋™์‚ฐ ๊ฑฐ๋ž˜ ์œ ํ˜• (ex. ๋งค๋งค, ์ „์›”์„ธ)
sigunguCode="41135"
yearMonth="202101"

df = ts.read_data(prod, trans, sigunguCode, yearMonth)


# 6. ์ง€์—ญ, ๊ธฐ๊ฐ„ ๋ณ„ ๋ฐ์ดํ„ฐ ํ”„๋ ˆ์ž„ ๋งŒ๋“ค๊ธฐ
prod="์•„ํŒŒํŠธ"                                           # ๋ถ€๋™์‚ฐ ์ƒํ’ˆ ์ข…๋ฅ˜ (ex. ์•„ํŒŒํŠธ, ์˜คํ”ผ์Šคํ…”, ๋‹จ๋…๋‹ค๊ฐ€๊ตฌ ๋“ฑ)
trans="๋งค๋งค"                                            # ๋ถ€๋™์‚ฐ ๊ฑฐ๋ž˜ ์œ ํ˜• (ex. ๋งค๋งค, ์ „์›”์„ธ)
sigunguCode="41135"
startYearMonth="202101"
endYearMonth="202111"

df = ts.collect_data(prod, trans, sigunguCode, startYearMonth, endYearMonth)

๊ตญํ† ๊ตํ†ต๋ถ€ ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ์ •๋ณด ์„œ๋น„์Šค

# 1. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž„ํฌํŠธ ๋ฐ ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ
import PublicDataReader as pdr
print(pdr.__version__)
print(pdr.__info__)

# 2. ๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ OpenAPI ์„œ๋น„์Šค ์ธ์ฆํ‚ค ์ž…๋ ฅํ•˜๊ธฐ
serviceKey = "๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ์„œ๋น„์Šค ํ‚ค"

# 3. ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ์ •๋ณด ์„œ๋น„์Šค OpenAPI ์„ธ์…˜ ์ •์˜ํ•˜๊ธฐ
# debug: True์ด๋ฉด ๋ชจ๋“  ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ, False์ด๋ฉด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋งŒ ์ถœ๋ ฅ (๊ธฐ๋ณธ๊ฐ’: False)
bd = pdr.Building(serviceKey, debug=True)

# 4. ์ง€์—ญ์ฝ”๋“œ(์‹œ๊ตฐ๊ตฌ์ฝ”๋“œ) ๊ฒ€์ƒ‰ํ•˜๊ธฐ
sigunguName = "๋ถ„๋‹น๊ตฌ"                                  # ์‹œ๊ตฐ๊ตฌ์ฝ”๋“œ: 41135
code = pdr.code_list()
code.loc[(code['์‹œ๊ตฐ๊ตฌ๋ช…'].str.contains(sigunguName, na=False)) &
         (code['์๋ฉด๋™๋ช…'].isna())]

# 5. ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ์ •๋ณด ์˜คํผ๋ ˆ์ด์…˜๋ณ„ ๋ฐ์ดํ„ฐ ์กฐํšŒ
category = "๊ธฐ๋ณธ๊ฐœ์š”"                                   # ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ ์ข…๋ฅ˜ (ex. ํ‘œ์ œ๋ถ€, ์ด๊ด„ํ‘œ์ œ๋ถ€, ์ „์œ ๋ถ€ ๋“ฑ)
sigunguCd = "41135"                                     # ์‹œ๊ตฐ๊ตฌ์ฝ”๋“œ(5)
bjdongCd = "11000"                                      # ์๋ฉด๋™์ฝ”๋“œ(5)
bun = "0541"                                            # ๋ณธ๋ฒˆ(4)
ji = "0000"                                             # ๋ถ€๋ฒˆ(4)

df = bd.read_data(category=category, sigunguCd=sigunguCd, bjdongCd=bjdongCd, bun=bun, ji=ji)

์†Œ์ƒ๊ณต์ธ ์ƒ๊ฐ€์—…์†Œ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

# 1. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž„ํฌํŠธ ๋ฐ ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ
import PublicDataReader as pdr
print(pdr.__version__)
print(pdr.__info__)

# 2. ๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ OpenAPI ์„œ๋น„์Šค ์ธ์ฆํ‚ค ์ž…๋ ฅํ•˜๊ธฐ
serviceKey = "๊ณต๊ณต ๋ฐ์ดํ„ฐ ํฌํ„ธ์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ์„œ๋น„์Šค ํ‚ค"

# 3. ์†Œ์ƒ๊ณต์ธ ์ƒ๊ฐ€์—…์†Œ ์ •๋ณด ์กฐํšŒ OpenAPI ์ธ์Šคํ„ด์Šค ์ƒ์„ฑํ•˜๊ธฐ
# debug: True์ด๋ฉด ๋ชจ๋“  ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ, False์ด๋ฉด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋งŒ ์ถœ๋ ฅ (๊ธฐ๋ณธ๊ฐ’: False)
si = pdr.StoreInfo(serviceKey, debug=True)

# 4. ๋ฐ์ดํ„ฐํ”„๋ ˆ์ž„์œผ๋กœ ์ž๋ฃŒ ์กฐํšŒํ•˜๊ธฐ

# 4-1. ์ง€์ •์ƒ๊ถŒ
category = "์ง€์ •์ƒ๊ถŒ"

key = "9174"

df = si.read_data(category=category, key=key)

# 4-2. ๋ฐ˜๊ฒฝ์ƒ๊ถŒ
category = "๋ฐ˜๊ฒฝ์ƒ๊ถŒ"

radius = 500
cx = 127.03641615737838
cy = 37.50059843782878

df = si.read_data(category=category, radius=radius, cx=cx, cy=cy)

# 4-3. ์‚ฌ๊ฐํ˜•์ƒ๊ถŒ
category = "์‚ฌ๊ฐํ˜•์ƒ๊ถŒ"

minx = 127.0327683531071
miny = 37.495967935149146
maxx = 127.04268179746694
maxy = 37.502402894207286

df = si.read_data(category=category, minx=minx, miny=miny, maxx=maxx, maxy=maxy)

# 4-4. ํ–‰์ •๊ตฌ์—ญ์ƒ๊ถŒ
category = "ํ–‰์ •๊ตฌ์—ญ์ƒ๊ถŒ"

divId = 'adongCd'
key = '1168058000'

df = si.read_data(category=category,divId=divId, key=key)

# 4-5. ๋‹จ์ผ์ƒ๊ฐ€
category = "๋‹จ์ผ์ƒ๊ฐ€"

key = '11757465'

df = si.read_data(category=category, key=key)

# 4-6. ๊ฑด๋ฌผ์ƒ๊ฐ€
category = "๊ฑด๋ฌผ์ƒ๊ฐ€"

key = '1168011000104940000004966'

df = si.read_data(category=category, key=key)

# 4-7. ์ง€๋ฒˆ์ƒ๊ฐ€
category = "์ง€๋ฒˆ์ƒ๊ฐ€"

key = '1165010100108120002'
indsLclsCd = 'Q'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd)

# 4-8. ํ–‰์ •๋™์ƒ๊ฐ€
category = "ํ–‰์ •๋™์ƒ๊ฐ€"

divId = 'adongCd'
key = '1168064000'
indsLclsCd = 'Q'

df = si.read_data(category=category, divId=divId, key=key, indsLclsCd=indsLclsCd)

# 4-9. ์ƒ๊ถŒ์ƒ๊ฐ€
category = "์ƒ๊ถŒ์ƒ๊ฐ€"

key = '9368'
indsLclsCd = 'Q'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd)

# 4-10. ๋ฐ˜๊ฒฝ์ƒ๊ฐ€
category = "๋ฐ˜๊ฒฝ์ƒ๊ฐ€"

radius = '500'
cx = 127.03641615737838
cy = 37.50059843782878
indsLclsCd = 'Q'

df = si.read_data(category=category, radius=radius, cx=cx, cy=cy, indsLclsCd=indsLclsCd)

# 4-11. ์‚ฌ๊ฐํ˜•์ƒ๊ฐ€
category = "์‚ฌ๊ฐํ˜•์ƒ๊ฐ€"

minx = 127.0327683531071
miny = 37.495967935149146
maxx = 127.04268179746694
maxy = 37.502402894207286
indsLclsCd = 'Q'

df = si.read_data(category=category, minx=minx, miny=miny, maxx=maxx, maxy=maxy, indsLclsCd=indsLclsCd)

# 4-12. ๋‹ค๊ฐํ˜•์ƒ๊ฐ€
category = "๋‹ค๊ฐํ˜•์ƒ๊ฐ€"

key = 'POLYGON((127.02355609555755 37.504264372557095, 127.02496157306963 37.50590702991155, 127.0270858825753 37.50486867039889, 127.02628121988377 37.503489842823114))'
indsLclsCd = 'Q'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd)

# 4-13. ์—…์ข…๋ณ„์ƒ๊ฐ€
category = "์—…์ข…๋ณ„์ƒ๊ฐ€"

divId = 'indsLclsCd'
key = 'Q'

df = si.read_data(category=category, divId=divId, key=key)

# 4-14. ์ˆ˜์ •์ผ์ž์ƒ๊ฐ€
category = "์ˆ˜์ •์ผ์ž์ƒ๊ฐ€"

key = '20200101'
indsLclsCd = 'Q'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd)

# 4-15. ์—…์ข…๋Œ€๋ถ„๋ฅ˜
category = "์—…์ข…๋Œ€๋ถ„๋ฅ˜"

df = si.read_data(category=category, key=key)

# 4-16. ์—…์ข…์ค‘๋ถ„๋ฅ˜
category = "์—…์ข…์ค‘๋ถ„๋ฅ˜"

indsLclsCd = 'Q'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd)

# 4-17. ์—…์ข…์†Œ๋ถ„๋ฅ˜
category = "์—…์ข…์†Œ๋ถ„๋ฅ˜"

indsLclsCd = 'Q'
indsMclsCd = 'Q01'

df = si.read_data(category=category, key=key, indsLclsCd=indsLclsCd, indsMclsCd=indsMclsCd)

์„œ์šธ ์—ด๋ฆฐ๋ฐ์ดํ„ฐ ๊ด‘์žฅ ๊ตํ†ต ๊ด€๋ จ ์ •๋ณด ์กฐํšŒ ์„œ๋น„์Šค

# 1. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž„ํฌํŠธ ๋ฐ ๋ฒ„์ „ ํ™•์ธํ•˜๊ธฐ
import PublicDataReader as pdr
print(pdr.__version__)
print(pdr.__info__)

# 2. ์„œ์šธ ์—ด๋ฆฐ๋ฐ์ดํ„ฐ ๊ด‘์žฅ OpenAPI ์„œ๋น„์Šค ์ธ์ฆํ‚ค ์ž…๋ ฅํ•˜๊ธฐ
serviceKey = "์„œ์šธ ์—ด๋ฆฐ๋ฐ์ดํ„ฐ ๊ด‘์žฅ์—์„œ ๋ฐœ๊ธ‰๋ฐ›์€ ์„œ๋น„์Šค ํ‚ค"

# 3. ๊ตญํ† ๊ตํ†ต๋ถ€ ๊ฑด์ถ•๋ฌผ๋Œ€์žฅ์ •๋ณด ์„œ๋น„์Šค OpenAPI ์„ธ์…˜ ์ •์˜ํ•˜๊ธฐ
# debug: True์ด๋ฉด ๋ชจ๋“  ๋ฉ”์‹œ์ง€ ์ถœ๋ ฅ, False์ด๋ฉด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋งŒ ์ถœ๋ ฅ (๊ธฐ๋ณธ๊ฐ’: False)
tp = pdr.Transportation(serviceKey, debug=True)

# 4. ์„œ์šธ์‹œ ์ง€ํ•˜์ฒ ํ˜ธ์„ ๋ณ„ ์—ญ๋ณ„ ์Šนํ•˜์ฐจ ์ธ์› ์ •๋ณด
category = "์ง€ํ•˜์ฒ ์Šนํ•˜์ฐจ"
date = "20211001"

df = tp.read_data(category=category, date=date)

# 5. ์„œ์šธ์‹œ ๋ฒ„์Šค๋…ธ์„ ๋ณ„ ์ •๋ฅ˜์žฅ๋ณ„ ์Šนํ•˜์ฐจ ์ธ์› ์ •๋ณด
category = "๋ฒ„์Šค์Šนํ•˜์ฐจ"
date = "20211001"

df = tp.read_data(category=category, date=date)

About

Open Source Public Data Reader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.4%
  • Jupyter Notebook 26.6%