[빅데이터분석] OpenAPI를 통한 데이터 수집과 MongoDB에 저장하기
<상명대학교 빅데이터분석 임좌상 교수님 수업 실습>
데이터 수집¶
데이터는 현대 비즈니스에서 가장 중요한 자산 중 하나로 자리매김하고 있다. 데이터 분석을 통한 지표 확인 및 인공지능 모델 학습까지 데이터의 중요성은 계속해서 커지고 있다.
이를 위해 데이터 수집은 필수적인 단계로 자리잡고 있으며, 다양한 소스로부터의 데이터를 효과적으로 수집하는 것은 매우 중요하다.
수업 내용을 바탕으로 실습한 해당 Jupyter Notebook에서는 데이터 수집의 다양한 측면을 다루고 있다. 먼저, Web Request를 통한 데이터 수집 방법을 알아볼 것이다. 기본적인 Web API 호출 방법에 대해 소개하려고 한다.
수집된 데이터의 포멧에 대해서 현업에서 가장 많이 사용되는 JSON과 XML 형식에 대한 이해를 바탕으로, 각각의 특징을 살펴볼 것이다.
이어서는 Open API를 활용하여 공공데이터 포털에서 데이터를 수집하는 방법을 다룬다. 다양한 도메인의 데이터에 접근하여 실제 활용 가능한 정보로 변환하는 과정을 살펴볼 것이다.
마지막으로, 수집한 데이터를 어떻게 저장하고 관리할지에 대대해서 MongoDB를 활용해 데이터를 저장하는 과정 다루어보려고 한다. MongoDB는 유연한 구조와 확장성을 제공하여 다양한 형태의 데이터를 효과적으로 저장할 수 있는 데이터베이스이다.
1. Web Request¶
- 기본적인 Web API를 호출하는 방법을 다룬다.
2. 데이터 포멧¶
- JSON 형식과 XML 형식에 대해서 다룬다.
3. Open API¶
- 공공데이터 포털의 데이터를 수집한다.
4. MongoDB¶
- 수집한 데이터를 MongoDB에 저장해본다
Web Request¶
import requests
r = requests.post("http://httpbin.org/post", data={"name":"js"})
r.json()
{'args': {}, 'data': '', 'files': {}, 'form': {'name': 'js'}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, br', 'Content-Length': '7', 'Content-Type': 'application/x-www-form-urlencoded', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.28.1', 'X-Amzn-Trace-Id': 'Root=1-6563afc8-21bb015105ef0a6d6f0a5de4'}, 'json': None, 'origin': '61.73.68.53', 'url': 'http://httpbin.org/post'}
r.status_code
200
XML¶
input = '''
<students> # root 태그는 하나만 허용.
<student x="1"> # 속성은 시작태그에 적고, key="value"로 구성. value는 따옴표.
<id>001</id> # 계층적으로 태그 구성.
<name>Kim</name>
</student>
<student x="2">
<id>002</id>
<name>Lee</name>
</student>
</students>
'''
import lxml.etree
root=lxml.etree.fromstring(input)
from io import StringIO
tree=lxml.etree.parse(StringIO(input))
root=tree.getroot()
root.tag #XML 트리의 최상위 노드의 tag
'students'
#XML 트리에 어떤 태그가 있는지 확인
for e in root:
print(e.tag)
student student
root.getchildren() #하위 요소를 모두 찾아 리스트로 만들어줌
[<Element student at 0x7fc6802f1a40>, <Element student at 0x7fc6802f13c0>]
root.getchildren()[1].attrib #2번째 student의 속성의 값 -> Dictionary
{'x': '2'}
root.getchildren()[1].attrib['x'] #Dictionary의 key를 통해서 value를 얻어옴
'2'
(root.getchildren()[1]).getchildren()[0].text #2번째 student의 id, name 중 첫번째 value
'002'
(root.getchildren()[1]).getchildren()[1].text #2번째 student의 id, name 중 두번째 value
'Lee'
for ee in root.getchildren(): # 하위 요소를 읽음
for e in ee.getchildren(): # 하위의 하위 요소를 읽음
if not e.text:
text = "None"
else:
text = e.text
print(e.tag + " => " + text)
id => 001 name => Kim id => 002 name => Lee
XML - XPath¶
xml의 데이터 추출 방식에 xpath, css, 정규식 등이 있다.
root.xpath('//@x') #//@는 어느 수준에 있든지 x 속성을 검색해서 Value를 추출한다
['1', '2']
root.xpath('//*[@x="1"]/id/text()')
#사각괄호를 사용하게 되면, 그 조건에 맞는 요소만 찾아낸다. [@x="1"]는 속성 x=1인 어떤 요소라도 (와일드카드 * 의미) 찾아내라는 의미이다.
['001']
XML - CSS¶
from lxml.cssselect import CSSSelector
sel = CSSSelector('student') # construct a CSS Selector
print(sel)
print(sel.css)
print(sel.path)
<CSSSelector 7fc680308190 for 'student'> student descendant-or-self::student
인코딩¶
# [승인] 도로교통공단_사망교통사고정보서비스
# 신청일 2023-09-22 만료예정일 2025-09-22
import urllib
print (urllib.parse.urlencode({'#q':'한글'}))
print (urllib.parse.urlencode({'#q':u'한글'.encode('utf-8')}))
%23q=%ED%95%9C%EA%B8%80 %23q=%ED%95%9C%EA%B8%80
인증키 작성하기¶
# %%writefile src/key.properties
# dataseoul=YOUR_DS_KEY
# gokr=YOUR_GO_KEY
# mongo=YOUR_MONGO_KEY
라이브러리 만들기(키를 얻어내는 기능)¶
%%writefile src/mylib.py
def getKey(keyPath):
d=dict()
f=open(keyPath,'r')
for line in f.readlines():
row=line.split('=')
row0=row[0]
d[row0]=row[1].strip()
return d
Overwriting src/mylib.py
import os
import src.mylib
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=src.mylib.getKey(keyPath)
mongo_pwd = key['mongo']
mongo_uri = f'mongodb+srv://sjh9708:{mongo_pwd}@mycluster.tfiobq6.mongodb.net/?retryWrites=true&w=majority'
# print (key['dataseoul'])
# print(mongo_uri)
JSON¶
#List of Dictionary
input = '''[
{ "id" : "001", "x" : "2", "name" : "Chuck"},
{ "id" : "009","x" : "7","name" : "Brent" }
]'''
import json
info = json.loads(input) #String to JSON
info
[{'id': '001', 'x': '2', 'name': 'Chuck'}, {'id': '009', 'x': '7', 'name': 'Brent'}]
info[0]
{'id': '001', 'x': '2', 'name': 'Chuck'}
info[0]['id']
'001'
print(f'User Count: {len(info)}')
User Count: 2
# Python Dictionary to JSON
import json
my=json.dumps(
['foo', {'bar': ('baz', None, 1.0, 2)}]
)
type(my)
str
Request로 IP 주소를 통해 지역정보 알아오기¶
import requests
url='http://api.ipstack.com/125.176.129.177?access_key=d7cdd0602f68e39767eba8a0e245e849'
r=requests.get(url)
r
<Response [200]>
r.text
'{"ip": "125.176.129.177", "type": "ipv4", "continent_code": "AS", "continent_name": "Asia", "country_code": "KR", "country_name": "South Korea", "region_code": "11", "region_name": "Seoul", "city": "Seoul", "zip": "100-011", "latitude": 37.56100082397461, "longitude": 126.98265075683594, "location": {"geoname_id": 1835848, "capital": "Seoul", "languages": [{"code": "ko", "name": "Korean", "native": "\\ud55c\\uad6d\\uc5b4"}], "country_flag": "https://assets.ipstack.com/flags/kr.svg", "country_flag_emoji": "\\ud83c\\uddf0\\ud83c\\uddf7", "country_flag_emoji_unicode": "U+1F1F0 U+1F1F7", "calling_code": "82", "is_eu": false}}'
geo = json.loads(r.text)
geo
{'ip': '125.176.129.177', 'type': 'ipv4', 'continent_code': 'AS', 'continent_name': 'Asia', 'country_code': 'KR', 'country_name': 'South Korea', 'region_code': '11', 'region_name': 'Seoul', 'city': 'Seoul', 'zip': '100-011', 'latitude': 37.56100082397461, 'longitude': 126.98265075683594, 'location': {'geoname_id': 1835848, 'capital': 'Seoul', 'languages': [{'code': 'ko', 'name': 'Korean', 'native': '한국어'}], 'country_flag': 'https://assets.ipstack.com/flags/kr.svg', 'country_flag_emoji': '🇰🇷', 'country_flag_emoji_unicode': 'U+1F1F0 U+1F1F7', 'calling_code': '82', 'is_eu': False}}
print(geo.get('ip'))
print(geo['ip'])
print(geo.get('location').get('capital'))
print(geo['location']['capital'])
125.176.129.177 125.176.129.177 Seoul Seoul
공공데이터¶
# 열린데이터포털은 활용신청 필요없고, 공공데이터포털은 활용신청 받아야 함
import urllib
# URL 인코딩 : URLdms 128 ASCII 문자만 받도록 되어있다. 한글의 경우 퍼센트 인코딩으로 표현된다.
print (urllib.parse.urlencode({'#q':'한글'}))
print (urllib.parse.urlencode({'#q':u'한글'.encode('utf-8')}))
%23q=%ED%95%9C%EA%B8%80 %23q=%ED%95%9C%EA%B8%80
# 인증키 읽기
import os
import src.mylib
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=src.mylib.getKey(keyPath)
# print (key['dataseoul'])
# print (key['gokr'])
서울시 지하철역 관련 정보를 수집해보자. 열린데이터 사이트에서 "서울교통공사 노선별 지하철역 정보"을 찾아보면, 그러한 정보를 제공하는 API 'SearchSTNBySubwayLineInfo'가 존재한다.
# 서울시 지하철역 정보 수집
# https://data.seoul.go.kr/dataList/OA-15442/S/1/datasetView.do
# 샘플URL : http://openapi.seoul.go.kr:8088/(인증키)/xml/SearchSTNBySubwayLineInfo/1/5/
dataseoul_key = key['dataseoul']
url=f'http://openapi.seoul.go.kr:8088/{dataseoul_key}/xml/SearchSTNBySubwayLineInfo/1/5/'
r=requests.get(url)
r.text # 지하철 정보 XML
'<?xml version="1.0" encoding="UTF-8"?>\n<SearchSTNBySubwayLineInfo>\n<list_total_count>777</list_total_count>\n<RESULT>\n<CODE>INFO-000</CODE>\n<MESSAGE>정상 처리되었습니다</MESSAGE>\n</RESULT>\n<row>\n<STATION_CD>1726</STATION_CD>\n<STATION_NM>직산</STATION_NM>\n<STATION_NM_ENG>Jiksan</STATION_NM_ENG>\n<LINE_NUM>01호선</LINE_NUM>\n<FR_CODE>P167</FR_CODE>\n<STATION_NM_CHN>稷山</STATION_NM_CHN>\n<STATION_NM_JPN>稷山</STATION_NM_JPN>\n</row>\n<row>\n<STATION_CD>1725</STATION_CD>\n<STATION_NM>성환</STATION_NM>\n<STATION_NM_ENG>Seonghwan</STATION_NM_ENG>\n<LINE_NUM>01호선</LINE_NUM>\n<FR_CODE>P166</FR_CODE>\n<STATION_NM_CHN>成歡</STATION_NM_CHN>\n<STATION_NM_JPN>成歡</STATION_NM_JPN>\n</row>\n<row>\n<STATION_CD>1724</STATION_CD>\n<STATION_NM>평택</STATION_NM>\n<STATION_NM_ENG>Pyeongtaek</STATION_NM_ENG>\n<LINE_NUM>01호선</LINE_NUM>\n<FR_CODE>P165</FR_CODE>\n<STATION_NM_CHN>平澤</STATION_NM_CHN>\n<STATION_NM_JPN>平澤</STATION_NM_JPN>\n</row>\n<row>\n<STATION_CD>1723</STATION_CD>\n<STATION_NM>평택지제</STATION_NM>\n<STATION_NM_ENG>PyeongtaekJije</STATION_NM_ENG>\n<LINE_NUM>01호선</LINE_NUM>\n<FR_CODE>P164</FR_CODE>\n<STATION_NM_CHN>芝制</STATION_NM_CHN>\n<STATION_NM_JPN>芝制</STATION_NM_JPN>\n</row>\n<row>\n<STATION_CD>1722</STATION_CD>\n<STATION_NM>서정리</STATION_NM>\n<STATION_NM_ENG>Seojeong-ri</STATION_NM_ENG>\n<LINE_NUM>01호선</LINE_NUM>\n<FR_CODE>P163</FR_CODE>\n<STATION_NM_CHN>西井里</STATION_NM_CHN>\n<STATION_NM_JPN>西井里</STATION_NM_JPN>\n</row>\n</SearchSTNBySubwayLineInfo>\n'
#Parameter
KEY = key['dataseoul']
TYPE = 'json'
SERVICE = 'SearchSTNBySubwayLineInfo'
START_INDEX = str(0)
END_INDEX=str(20)
LINE_NUM=str(2)
params="/".join([KEY,TYPE,SERVICE,START_INDEX,END_INDEX,'','',LINE_NUM])
print(params[30:])
#Url
_url='http://openapi.seoul.go.kr:8088'
# url=urllib.parse.urljoin(_url, params) 인자가 합성되지만 생략된 인자가 생략됨. 따라서 urllib을 사용하면 제대로 검색할 수 없음
url = "/".join([_url, params])
# print(url)
r=requests.get(url)
stations = json.loads(r.text)
stations # 지하철 정보 Json
/json/SearchSTNBySubwayLineInfo/0/20///2
{'SearchSTNBySubwayLineInfo': {'list_total_count': 777, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'STATION_CD': '1726', 'STATION_NM': '직산', 'STATION_NM_ENG': 'Jiksan', 'LINE_NUM': '01호선', 'FR_CODE': 'P167', 'STATION_NM_CHN': '稷山', 'STATION_NM_JPN': '稷山'}, {'STATION_CD': '1725', 'STATION_NM': '성환', 'STATION_NM_ENG': 'Seonghwan', 'LINE_NUM': '01호선', 'FR_CODE': 'P166', 'STATION_NM_CHN': '成歡', 'STATION_NM_JPN': '成歡'}, {'STATION_CD': '1724', 'STATION_NM': '평택', 'STATION_NM_ENG': 'Pyeongtaek', 'LINE_NUM': '01호선', 'FR_CODE': 'P165', 'STATION_NM_CHN': '平澤', 'STATION_NM_JPN': '平澤'}, {'STATION_CD': '1723', 'STATION_NM': '평택지제', 'STATION_NM_ENG': 'PyeongtaekJije', 'LINE_NUM': '01호선', 'FR_CODE': 'P164', 'STATION_NM_CHN': '芝制', 'STATION_NM_JPN': '芝制'}, {'STATION_CD': '1722', 'STATION_NM': '서정리', 'STATION_NM_ENG': 'Seojeong-ri', 'LINE_NUM': '01호선', 'FR_CODE': 'P163', 'STATION_NM_CHN': '西井里', 'STATION_NM_JPN': '西井里'}, {'STATION_CD': '1721', 'STATION_NM': '송탄', 'STATION_NM_ENG': 'Songtan', 'LINE_NUM': '01호선', 'FR_CODE': 'P162', 'STATION_NM_CHN': '松炭', 'STATION_NM_JPN': '松炭'}, {'STATION_CD': '1718', 'STATION_NM': '오산대', 'STATION_NM_ENG': 'Osan College', 'LINE_NUM': '01호선', 'FR_CODE': 'P159', 'STATION_NM_CHN': '烏山大', 'STATION_NM_JPN': '烏山大'}, {'STATION_CD': '1717', 'STATION_NM': '세마', 'STATION_NM_ENG': 'Sema', 'LINE_NUM': '01호선', 'FR_CODE': 'P158', 'STATION_NM_CHN': '洗馬', 'STATION_NM_JPN': '洗馬'}, {'STATION_CD': '0152', 'STATION_NM': '종각', 'STATION_NM_ENG': 'Jonggak', 'LINE_NUM': '01호선', 'FR_CODE': '131', 'STATION_NM_CHN': '鐘閣', 'STATION_NM_JPN': '鐘閣'}, {'STATION_CD': '0151', 'STATION_NM': '시청', 'STATION_NM_ENG': 'City Hall', 'LINE_NUM': '01호선', 'FR_CODE': '132', 'STATION_NM_CHN': '市廳', 'STATION_NM_JPN': '市廳'}, {'STATION_CD': '1716', 'STATION_NM': '병점', 'STATION_NM_ENG': 'Byeongjeom', 'LINE_NUM': '01호선', 'FR_CODE': 'P157', 'STATION_NM_CHN': '餠店', 'STATION_NM_JPN': '餠店'}, {'STATION_CD': '1715', 'STATION_NM': '세류', 'STATION_NM_ENG': 'Seryu', 'LINE_NUM': '01호선', 'FR_CODE': 'P156', 'STATION_NM_CHN': '細柳', 'STATION_NM_JPN': '細柳'}, {'STATION_CD': '1714', 'STATION_NM': '독산', 'STATION_NM_ENG': 'Doksan', 'LINE_NUM': '01호선', 'FR_CODE': 'P143', 'STATION_NM_CHN': '禿山', 'STATION_NM_JPN': '禿山'}, {'STATION_CD': '1401', 'STATION_NM': '봉명', 'STATION_NM_ENG': 'Bongmyeong', 'LINE_NUM': '01호선', 'FR_CODE': 'P170', 'STATION_NM_CHN': '鳳鳴', 'STATION_NM_JPN': '鳳鳴'}, {'STATION_CD': '1402', 'STATION_NM': '쌍용', 'STATION_NM_ENG': 'Ssangyong', 'LINE_NUM': '01호선', 'FR_CODE': 'P171', 'STATION_NM_CHN': '雙龍', 'STATION_NM_JPN': '雙龍'}, {'STATION_CD': '1403', 'STATION_NM': '아산', 'STATION_NM_ENG': 'Asan', 'LINE_NUM': '01호선', 'FR_CODE': 'P172', 'STATION_NM_CHN': '牙山', 'STATION_NM_JPN': '牙山'}, {'STATION_CD': '1404', 'STATION_NM': '탕정', 'STATION_NM_ENG': 'Tangjeong', 'LINE_NUM': '01호선', 'FR_CODE': 'P173', 'STATION_NM_CHN': '', 'STATION_NM_JPN': ''}, {'STATION_CD': '1405', 'STATION_NM': '배방', 'STATION_NM_ENG': 'Baebang', 'LINE_NUM': '01호선', 'FR_CODE': 'P174', 'STATION_NM_CHN': '排芳', 'STATION_NM_JPN': '排芳'}, {'STATION_CD': '1407', 'STATION_NM': '온양온천', 'STATION_NM_ENG': 'Onyang oncheon', 'LINE_NUM': '01호선', 'FR_CODE': 'P176', 'STATION_NM_CHN': '溫陽溫泉', 'STATION_NM_JPN': '溫陽溫泉'}, {'STATION_CD': '1408', 'STATION_NM': '신창', 'STATION_NM_ENG': 'Sinchang', 'LINE_NUM': '01호선', 'FR_CODE': 'P177', 'STATION_NM_CHN': '新昌', 'STATION_NM_JPN': '新昌'}]}}
for e in stations['SearchSTNBySubwayLineInfo']['row']:
print ("{0:4s}\t{1:15s}\t{2:3s}\t{3:2s}".format(e['STATION_CD'], e['STATION_NM'], e['FR_CODE'], e['LINE_NUM']))
1726 직산 P167 01호선 1725 성환 P166 01호선 1724 평택 P165 01호선 1723 평택지제 P164 01호선 1722 서정리 P163 01호선 1721 송탄 P162 01호선 1718 오산대 P159 01호선 1717 세마 P158 01호선 0152 종각 131 01호선 0151 시청 132 01호선 1716 병점 P157 01호선 1715 세류 P156 01호선 1714 독산 P143 01호선 1401 봉명 P170 01호선 1402 쌍용 P171 01호선 1403 아산 P172 01호선 1404 탕정 P173 01호선 1405 배방 P174 01호선 1407 온양온천 P176 01호선 1408 신창 P177 01호선
지하철 스크립트 저장¶
%%writefile src/ds_open_subway_json.py
#!/usr/bin/env python
# coding: utf-8
import os
import requests
import urllib
import mylib # NO! src.mylib -> 상대적 디렉터리이기 때문. src 밑에 저장하기 때문
def doIt():
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=mylib.getKey(keyPath)
# (1) make params with resource IDs
KEY=str(key['dataseoul'])
TYPE='json'
SERVICE='SearchSTNBySubwayLineInfo'
LINE_NUM=str(2)
START_INDEX=str(1)
END_INDEX=str(10)
#params=os.path.join(KEY,TYPE,SERVICE,START_INDEX,END_INDEX,LINE_NUM)
params="/".join([KEY,TYPE,SERVICE,START_INDEX,END_INDEX,'','',LINE_NUM])
# (2) make a full url
_url='http://openAPI.seoul.go.kr:8088' #NOTE slash: do not use 'http://openAPI.seoul.go.kr:8088/'
#url=urllib.parse.urljoin(_url,params)
url="/".join([_url,params])
#print(url)
# (3) get data
r=requests.get(url)
#print(r)
stations=r.json()
#print(stations)
for e in stations['SearchSTNBySubwayLineInfo']['row']:
print (u"{0:4.0f}\t{1:15s}\t{2:3s}\t{3:2s}".format(e['STATION_CD'], e['STATION_NM'], e['FR_CODE'], e['LINE_NUM']))
if __name__ == "__main__":
doIt()
Overwriting src/ds_open_subway_json.py
%%writefile src/ds_open_subway_iter_json.py
#!/usr/bin/env python
# coding: utf-8
import os
import requests
import urllib
import mylib # NO! src.mylib
def doIt():
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=mylib.getKey(keyPath)
# (1) make params with resource IDs
KEY=str(key['dataseoul'])
TYPE='json'
#OLD: SERVICE='SearchSTNBySubwayLineService'
SERVICE='SearchSTNBySubwayLineInfo'
LINE_NUM=str(2)
START_INDEX=str(1)
END_INDEX=str(10)
startIndex=1
endIndex=10
list_total_count=0 # set later
while True:
START_INDEX=str(startIndex)
END_INDEX=str(endIndex)
#params=os.path.join(KEY,TYPE,SERVICE,START_INDEX,END_INDEX,LINE_NUM)
params="/".join([KEY,TYPE,SERVICE,START_INDEX,END_INDEX,'','',LINE_NUM])
# (2) make a full url
_url='http://openAPI.seoul.go.kr:8088' #NOTE slash: do not use 'http://openAPI.seoul.go.kr:8088/'
#url=urllib.parse.urljoin(_url,params)
url="/".join([_url,params])
#print(url)
# (3) get data
r=requests.get(url)
#print(r)
stations=r.json()
#print(stations)
if(startIndex==1):
list_total_count=stations['SearchSTNBySubwayLineInfo']['list_total_count']
print("- Total Count: ", list_total_count)
if(stations["SearchSTNBySubwayLineInfo"]["RESULT"]["CODE"]=="INFO-000"):
for e in stations['SearchSTNBySubwayLineInfo']['row']:
print (u"{0:3d}\t{1:4.0f}\t{2:15s}\t{3:3s}\t{4:2s}".format(
startIndex, e['STATION_CD'], e['STATION_NM'], e['FR_CODE'], e['LINE_NUM']
))
startIndex+=10
endIndex+=10
else:
print("Error: "+str(startIndex))
if(endIndex > list_total_count):
print("----- Ending endIndex=",endIndex)
break # exit from the while loop
if __name__ == "__main__":
doIt()
Overwriting src/ds_open_subway_iter_json.py
!python3 src/ds_open_subway_iter_json.py
- Total Count: 777 Traceback (most recent call last): File "/Users/sojaehwi/Documents/GitHub/LECTURE_Bigdata/src/ds_open_subway_iter_json.py", line 54, in <module> doIt() File "/Users/sojaehwi/Documents/GitHub/LECTURE_Bigdata/src/ds_open_subway_iter_json.py", line 42, in doIt print (u"{0:3d}\t{1:4.0f}\t{2:15s}\t{3:3s}\t{4:2s}".format( ValueError: Unknown format code 'f' for object of type 'str'
MongoDB¶
import os
import src.mylib
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=src.mylib.getKey(keyPath)
mongo_pwd = key['mongo']
uriCloud = f'mongodb+srv://sjh9708:{mongo_pwd}@mycluster.tfiobq6.mongodb.net/?retryWrites=true&w=majority'
# print(uriCloud)
import pymongo
Client = pymongo.MongoClient(uriCloud)
db=Client.myDB
_id=1
_name='js'
_age=22
_country='ko'
db.myPyCol.insert_one({
"id": _id,
"name": _name,
"age": _age,
"country": _country
})
<pymongo.results.InsertOneResult at 0x7fc698305940>
print(Client.list_database_names())
['ds_open_subwayPassengersDb', 'ds_sanggwun', 'midterm', 'myDB', 'myDB4', 'admin', 'local']
print(db.list_collection_names())
['myPyCol']
문제 3: 행정동별 서울생활인구 (단기체류 외국인)¶
# https://data.seoul.go.kr/dataList/OA-14993/S/1/datasetView.do
import os
import src.mylib
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=src.mylib.getKey(keyPath)
KEY=str(key['dataseoul'])
TYPE='xml'
SERVICE='SPOP_FORN_TEMP_RESD_DONG'
START_INDEX=str(1)
END_INDEX=str(5)
STDR_DE_ID=str(20200617)
#params=os.path.join(KEY,TYPE,SERVICE,START_INDEX,END_INDEX)
params="/".join([KEY,TYPE,SERVICE,START_INDEX,END_INDEX,STDR_DE_ID])
print (params[30:]) # 인증키(30자리)를 제거하고 출력한다
/xml/SPOP_FORN_TEMP_RESD_DONG/1/5/20200617
import urllib
_url='http://openapi.seoul.go.kr:8088/'
url=urllib.parse.urljoin(_url,params)
# print(url)
# http://openapi.seoul.go.kr:8088/MY_KEY/xml/SPOP_FORN_TEMP_RESD_DONG/1/5/20200617
import requests
data=requests.get(url).text
print (data)
<?xml version="1.0" encoding="UTF-8"?> <SPOP_FORN_TEMP_RESD_DONG> <list_total_count>9849</list_total_count> <RESULT> <CODE>INFO-000</CODE> <MESSAGE>정상 처리되었습니다</MESSAGE> </RESULT> <row> <STDR_DE_ID>20200617</STDR_DE_ID> <TMZON_PD_SE>00</TMZON_PD_SE> <ADSTRD_CODE_SE>11110515</ADSTRD_CODE_SE> <TOT_LVPOP_CO>248.866</TOT_LVPOP_CO> <CHINA_STAYPOP_CO>86.4335</CHINA_STAYPOP_CO> <ETC_STAYPOP_CO>162.432</ETC_STAYPOP_CO> </row> <row> <STDR_DE_ID>20200617</STDR_DE_ID> <TMZON_PD_SE>00</TMZON_PD_SE> <ADSTRD_CODE_SE>11110530</ADSTRD_CODE_SE> <TOT_LVPOP_CO>71.2628</TOT_LVPOP_CO> <CHINA_STAYPOP_CO>0</CHINA_STAYPOP_CO> <ETC_STAYPOP_CO>71.2627</ETC_STAYPOP_CO> </row> <row> <STDR_DE_ID>20200617</STDR_DE_ID> <TMZON_PD_SE>00</TMZON_PD_SE> <ADSTRD_CODE_SE>11110540</ADSTRD_CODE_SE> <TOT_LVPOP_CO>150.1777</TOT_LVPOP_CO> <CHINA_STAYPOP_CO>86.2246</CHINA_STAYPOP_CO> <ETC_STAYPOP_CO>63.9532</ETC_STAYPOP_CO> </row> <row> <STDR_DE_ID>20200617</STDR_DE_ID> <TMZON_PD_SE>00</TMZON_PD_SE> <ADSTRD_CODE_SE>11110550</ADSTRD_CODE_SE> <TOT_LVPOP_CO>136.7137</TOT_LVPOP_CO> <CHINA_STAYPOP_CO>79.3833</CHINA_STAYPOP_CO> <ETC_STAYPOP_CO>57.3305</ETC_STAYPOP_CO> </row> <row> <STDR_DE_ID>20200617</STDR_DE_ID> <TMZON_PD_SE>00</TMZON_PD_SE> <ADSTRD_CODE_SE>11110560</ADSTRD_CODE_SE> <TOT_LVPOP_CO>174.824</TOT_LVPOP_CO> <CHINA_STAYPOP_CO>0</CHINA_STAYPOP_CO> <ETC_STAYPOP_CO>174.8241</ETC_STAYPOP_CO> </row> </SPOP_FORN_TEMP_RESD_DONG>
import lxml
import lxml.etree
tree = lxml.etree.fromstring(data.encode('utf-8'))
nodes = tree.xpath('//TOT_LVPOP_CO') #속성
print(nodes)
for node in nodes:
print(node.text)
[<Element TOT_LVPOP_CO at 0x7fc6a0b97740>, <Element TOT_LVPOP_CO at 0x7fc6c05ac8c0>, <Element TOT_LVPOP_CO at 0x7fc6c05ac1c0>, <Element TOT_LVPOP_CO at 0x7fc6c059e840>, <Element TOT_LVPOP_CO at 0x7fc6c059ecc0>] 248.866 71.2628 150.1777 136.7137 174.824
%%writefile src/ds_open_foreigners_xml.py
import os
import urllib
import requests
import lxml
import lxml.etree
import mylib #from src import mylib
def doIt():
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=mylib.getKey(keyPath)
KEY=str(key['dataseoul'])
TYPE='xml'
SERVICE='SPOP_FORN_TEMP_RESD_DONG'
START_INDEX=str(1)
END_INDEX=str(10)
STDR_DE_ID=str(20200617)
#params="/".join([KEY,TYPE,SERVICE,START_INDEX,END_INDEX,STDR_DE_ID])
#_url='http://openAPI.seoul.go.kr:8088/'
_url='http://openAPI.seoul.go.kr:8088' # NOTE: the slash at the end removed
#url=urllib.parse.urljoin(_url,params)
url="/".join([_url,KEY,TYPE,SERVICE,START_INDEX,END_INDEX,STDR_DE_ID])
data=requests.get(url).text
#tree=lxml.etree.parse(StringIO.StringIO(data.encode('utf-8')))
tree=lxml.etree.fromstring(data.encode('utf-8'))
nodes=tree.xpath('//TOT_LVPOP_CO')
for node in nodes:
print (node.text)
if __name__ == "__main__":
doIt()
Overwriting src/ds_open_foreigners_xml.py
!python3 src/ds_open_foreigners_xml.py
248.866 71.2628 150.1777 136.7137 174.824 0.4833 0.2163 35.2093 756.5433 87.6117
문제 4: 서울시 지하철역별 월별 승하차인원 구하기¶
import os
import src.mylib as mylib
keyPath = os.path.join(os.getcwd(), 'src', 'key.properties')
key = mylib.getKey(keyPath)
# key
_url='http://openAPI.seoul.go.kr:8088'
_key=str(key['dataseoul'])
_type='json'
_service='CardSubwayStatsNew'
_start_index=1
_end_index=5
_use_dt='20220801'
URL을 만드는 세 가지 방법¶
import urllib
_api0=os.path.join(_url,_key,_type,_service,str(_start_index),str(_end_index),_use_dt)
_api1="/".join([_url,_key,_type,_service,str(_start_index),str(_end_index),_use_dt])
_api2=urllib.parse.urljoin(_url,"/".join([_key,_type,_service,str(_start_index),str(_end_index),_use_dt]))
# print("api0: ", _api0)
# print("api1: ", _api1)
# print("api2: ", _api2)
# api0: http://openAPI.seoul.go.kr:8088/MY_KEY/json/CardSubwayStatsNew/1/5/20220801
# api1: http://openAPI.seoul.go.kr:8088/MY_KEY/json/CardSubwayStatsNew/1/5/20220801
# api2: http://openAPI.seoul.go.kr:8088/MY_KEY/json/CardSubwayStatsNew/1/5/20220801
데이터 수집¶
import requests
response = requests.get(_api1)
print(response.text)
{"CardSubwayStatsNew":{"list_total_count":605,"RESULT":{"CODE":"INFO-000","MESSAGE":"정상 처리되었습니다"},"row":[{"USE_DT":"20220801","LINE_NUM":"1호선","SUB_STA_NM":"서울역","RIDE_PASGR_NUM":47711.0,"ALIGHT_PASGR_NUM":45432.0,"WORK_DT":"20220804"},{"USE_DT":"20220801","LINE_NUM":"1호선","SUB_STA_NM":"시청","RIDE_PASGR_NUM":21830.0,"ALIGHT_PASGR_NUM":22357.0,"WORK_DT":"20220804"},{"USE_DT":"20220801","LINE_NUM":"1호선","SUB_STA_NM":"종각","RIDE_PASGR_NUM":35945.0,"ALIGHT_PASGR_NUM":35727.0,"WORK_DT":"20220804"},{"USE_DT":"20220801","LINE_NUM":"1호선","SUB_STA_NM":"종로3가","RIDE_PASGR_NUM":19983.0,"ALIGHT_PASGR_NUM":18539.0,"WORK_DT":"20220804"},{"USE_DT":"20220801","LINE_NUM":"1호선","SUB_STA_NM":"종로5가","RIDE_PASGR_NUM":18002.0,"ALIGHT_PASGR_NUM":18063.0,"WORK_DT":"20220804"}]}}
JSON 파싱 (문자열 -> JSON)¶
if response.status_code == 200:
data = response.json() # JSON 파싱
else:
print("오류:", response.status_code)
sub=response.json()
print(sub)
{'CardSubwayStatsNew': {'list_total_count': 605, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'USE_DT': '20220801', 'LINE_NUM': '1호선', 'SUB_STA_NM': '서울역', 'RIDE_PASGR_NUM': 47711.0, 'ALIGHT_PASGR_NUM': 45432.0, 'WORK_DT': '20220804'}, {'USE_DT': '20220801', 'LINE_NUM': '1호선', 'SUB_STA_NM': '시청', 'RIDE_PASGR_NUM': 21830.0, 'ALIGHT_PASGR_NUM': 22357.0, 'WORK_DT': '20220804'}, {'USE_DT': '20220801', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종각', 'RIDE_PASGR_NUM': 35945.0, 'ALIGHT_PASGR_NUM': 35727.0, 'WORK_DT': '20220804'}, {'USE_DT': '20220801', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로3가', 'RIDE_PASGR_NUM': 19983.0, 'ALIGHT_PASGR_NUM': 18539.0, 'WORK_DT': '20220804'}, {'USE_DT': '20220801', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로5가', 'RIDE_PASGR_NUM': 18002.0, 'ALIGHT_PASGR_NUM': 18063.0, 'WORK_DT': '20220804'}]}}
데이터 추출¶
rows = sub['CardSubwayStatsNew']['row']
for row in rows:
print(row.get('SUB_STA_NM'))
print(row['SUB_STA_NM'])
서울역 서울역 시청 시청 종각 종각 종로3가 종로3가 종로5가 종로5가
for row in rows:
sum_ridenum = float(row['RIDE_PASGR_NUM'] + row['RIDE_PASGR_NUM'])
print ("{0:5s}\t{1:10s}\t{2:9.1f}\t{3:9.1f}\t{4:9.1f}"
.format(row['LINE_NUM'],row['SUB_STA_NM'],row['RIDE_PASGR_NUM'],row['ALIGHT_PASGR_NUM'], sum_ridenum))
1호선 서울역 47711.0 45432.0 95422.0 1호선 시청 21830.0 22357.0 43660.0 1호선 종각 35945.0 35727.0 71890.0 1호선 종로3가 19983.0 18539.0 39966.0 1호선 종로5가 18002.0 18063.0 36004.0
문제 5: 서울시 지하철 호선별 역별 시간대별 승하차 인원 정보¶
import os
import src.mylib as mylib
keyPath = os.path.join(os.getcwd(), 'src', 'key.properties')
key = mylib.getKey(keyPath)
# key
XML¶
_url='http://openAPI.seoul.go.kr:8088'
_key=str(key['dataseoul'])
_type='xml'
_service='CardSubwayTime'
_start_index=1
_end_index=5
_use_mon='202106'
import requests
#여기서는 INDEX를 통해 1회에 5건씩, iter를 통해 1회 반복해서 총 5건의 데이터를 가져오고 있다.
#iter를 크게 또는 작게 해서 데이터 수집량을 조정할 수 있다. 각 레코드는 시간대별 승하차인원을 포함하고 있다.
_maxIter=2 #몇페이지까지?
_iter=0
while _iter<_maxIter:
_api="/".join([_url,_key,_type,_service,str(_start_index),str(_end_index),_use_mon])
#print _api
response = requests.get(_api).text
print(response)
_start_index+=5
_end_index+=5
_iter+=1
<?xml version="1.0" encoding="UTF-8"?> <CardSubwayTime> <list_total_count>608</list_total_count> <RESULT> <CODE>INFO-000</CODE> <MESSAGE>정상 처리되었습니다</MESSAGE> </RESULT> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>서울역</SUB_STA_NM> <FOUR_RIDE_NUM>654</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>17</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>9008</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>6400</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>12474</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>37203</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>37253</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>91875</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>59876</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>187805</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>44619</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>118679</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>42611</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>57710</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>49533</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>50003</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>59357</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>53317</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>61171</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>53687</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>53310</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>49094</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>65767</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>52788</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>76249</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>53969</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>122928</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>64693</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>184907</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>73978</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>87575</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>46769</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>59961</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>30743</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>65078</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>27435</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>44921</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>22829</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>11581</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>8024</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>30</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>637</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>1</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>동묘앞</SUB_STA_NM> <FOUR_RIDE_NUM>51</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>1</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>3218</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>1100</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>3422</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>4802</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>5896</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>9703</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>9194</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>24921</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>8022</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>17333</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>9687</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>19292</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>14091</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>24305</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>20089</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>26186</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>24776</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>28141</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>27144</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>26643</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>28360</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>23213</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>31119</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>17744</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>27036</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>13759</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>23606</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>10098</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>11006</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>6510</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>6119</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>4409</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>5485</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>4265</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>3405</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>5689</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>1035</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>2589</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>4</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>1348</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>시청</SUB_STA_NM> <FOUR_RIDE_NUM>37</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>0</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>1881</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>4340</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>2948</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>21443</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>6280</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>62346</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>7740</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>167991</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>8117</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>72853</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>9284</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>29250</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>14030</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>27989</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>15295</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>25037</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>18849</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>24492</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>23331</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>20032</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>30469</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>17869</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>36116</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>15593</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>66595</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>16611</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>135842</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>17805</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>46850</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>8139</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>38173</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>4455</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>39048</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>4234</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>28501</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>3686</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>4390</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>1485</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>3</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>92</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>종각</SUB_STA_NM> <FOUR_RIDE_NUM>127</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>1</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>2314</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>4354</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>2868</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>23755</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>5479</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>96712</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>8419</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>223459</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>10625</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>131420</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>14727</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>50878</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>23057</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>44506</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>27707</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>39830</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>34538</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>40864</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>40378</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>33173</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>49745</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>29610</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>58664</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>29692</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>114985</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>33365</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>192552</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>39621</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>78735</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>19163</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>64989</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>7386</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>81179</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>4790</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>63653</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>3763</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>8153</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>1675</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>21</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>135</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>종로3가</SUB_STA_NM> <FOUR_RIDE_NUM>191</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>24</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>3227</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>3388</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>3069</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>13080</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>5108</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>25462</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>7412</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>70639</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>11673</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>73336</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>18502</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>57312</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>29882</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>55725</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>37009</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>53678</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>44050</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>51189</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>47626</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>46621</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>53071</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>40250</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>56955</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>34679</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>68711</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>31234</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>94683</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>33315</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>55993</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>16571</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>41534</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>6332</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>51588</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>4938</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>47756</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>4591</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>6768</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>2318</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>25</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>413</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> </CardSubwayTime> <?xml version="1.0" encoding="UTF-8"?> <CardSubwayTime> <list_total_count>608</list_total_count> <RESULT> <CODE>INFO-000</CODE> <MESSAGE>정상 처리되었습니다</MESSAGE> </RESULT> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>종로5가</SUB_STA_NM> <FOUR_RIDE_NUM>71</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>0</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>1526</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>3779</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>2574</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>16992</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>4781</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>39423</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>7414</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>103060</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>11525</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>62717</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>18431</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>50987</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>27735</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>48857</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>34387</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>47295</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>40094</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>42416</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>46633</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>39899</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>50981</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>35861</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>55982</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>29188</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>71386</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>26232</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>96880</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>22727</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>45846</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>12621</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>29493</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>5474</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>29266</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>4184</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>20319</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>3607</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>2740</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>1681</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>4</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>268</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>1</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>1</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>동대문</SUB_STA_NM> <FOUR_RIDE_NUM>715</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>14</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>13235</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>2131</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>8936</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>6979</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>14776</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>12395</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>18660</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>24732</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>16788</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>22866</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>15988</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>21388</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>17257</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>22109</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>20561</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>21732</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>21099</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>20786</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>22318</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>19616</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>23370</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>18703</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>24338</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>17325</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>23923</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>17672</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>22895</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>18354</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>15871</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>19089</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>12693</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>12789</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>13040</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>10134</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>11167</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>10601</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>2811</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>8211</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>16</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>1434</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>1</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>1</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>신설동</SUB_STA_NM> <FOUR_RIDE_NUM>343</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>3</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>8150</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>3192</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>8131</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>10929</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>17021</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>25745</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>24583</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>62999</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>16472</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>33400</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>14689</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>20639</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>16427</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>17238</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>17625</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>16913</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>19712</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>17440</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>19363</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>16063</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>20684</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>16772</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>28784</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>17481</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>39357</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>20038</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>57642</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>25012</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>20823</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>17529</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>13880</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>10932</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>13378</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>10102</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>10189</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>11809</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>1952</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>5451</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>10</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>449</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>제기동</SUB_STA_NM> <FOUR_RIDE_NUM>360</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>3</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>5020</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>2150</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>8625</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>9488</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>21818</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>18800</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>31428</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>42110</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>22254</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>37145</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>25534</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>39572</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>33701</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>40192</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>37380</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>36944</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>37913</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>36302</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>38816</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>38060</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>39042</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>34744</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>36805</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>29316</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>38480</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>23319</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>37172</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>26182</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>16542</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>17773</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>10447</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>11211</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>8822</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>10198</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>7253</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>11830</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>2042</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>4844</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>8</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>408</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>0</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>1</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> <row> <USE_MON>202106</USE_MON> <LINE_NUM>1호선</LINE_NUM> <SUB_STA_NM>청량리(서울시립대입구)</SUB_STA_NM> <FOUR_RIDE_NUM>1114</FOUR_RIDE_NUM> <FOUR_ALIGHT_NUM>17</FOUR_ALIGHT_NUM> <FIVE_RIDE_NUM>10556</FIVE_RIDE_NUM> <FIVE_ALIGHT_NUM>4752</FIVE_ALIGHT_NUM> <SIX_RIDE_NUM>14555</SIX_RIDE_NUM> <SIX_ALIGHT_NUM>20601</SIX_ALIGHT_NUM> <SEVEN_RIDE_NUM>36398</SEVEN_RIDE_NUM> <SEVEN_ALIGHT_NUM>18127</SEVEN_ALIGHT_NUM> <EIGHT_RIDE_NUM>44314</EIGHT_RIDE_NUM> <EIGHT_ALIGHT_NUM>36112</EIGHT_ALIGHT_NUM> <NINE_RIDE_NUM>30993</NINE_RIDE_NUM> <NINE_ALIGHT_NUM>33651</NINE_ALIGHT_NUM> <TEN_RIDE_NUM>30325</TEN_RIDE_NUM> <TEN_ALIGHT_NUM>34593</TEN_ALIGHT_NUM> <ELEVEN_RIDE_NUM>32895</ELEVEN_RIDE_NUM> <ELEVEN_ALIGHT_NUM>36922</ELEVEN_ALIGHT_NUM> <TWELVE_RIDE_NUM>36644</TWELVE_RIDE_NUM> <TWELVE_ALIGHT_NUM>38152</TWELVE_ALIGHT_NUM> <THIRTEEN_RIDE_NUM>37957</THIRTEEN_RIDE_NUM> <THIRTEEN_ALIGHT_NUM>37161</THIRTEEN_ALIGHT_NUM> <FOURTEEN_RIDE_NUM>38453</FOURTEEN_RIDE_NUM> <FOURTEEN_ALIGHT_NUM>41488</FOURTEEN_ALIGHT_NUM> <FIFTEEN_RIDE_NUM>41308</FIFTEEN_RIDE_NUM> <FIFTEEN_ALIGHT_NUM>40046</FIFTEEN_ALIGHT_NUM> <SIXTEEN_RIDE_NUM>48019</SIXTEEN_RIDE_NUM> <SIXTEEN_ALIGHT_NUM>37625</SIXTEEN_ALIGHT_NUM> <SEVENTEEN_RIDE_NUM>45267</SEVENTEEN_RIDE_NUM> <SEVENTEEN_ALIGHT_NUM>37535</SEVENTEEN_ALIGHT_NUM> <EIGHTEEN_RIDE_NUM>41132</EIGHTEEN_RIDE_NUM> <EIGHTEEN_ALIGHT_NUM>46814</EIGHTEEN_ALIGHT_NUM> <NINETEEN_RIDE_NUM>22408</NINETEEN_RIDE_NUM> <NINETEEN_ALIGHT_NUM>31284</NINETEEN_ALIGHT_NUM> <TWENTY_RIDE_NUM>16802</TWENTY_RIDE_NUM> <TWENTY_ALIGHT_NUM>17867</TWENTY_ALIGHT_NUM> <TWENTY_ONE_RIDE_NUM>13163</TWENTY_ONE_RIDE_NUM> <TWENTY_ONE_ALIGHT_NUM>16739</TWENTY_ONE_ALIGHT_NUM> <TWENTY_TWO_RIDE_NUM>9007</TWENTY_TWO_RIDE_NUM> <TWENTY_TWO_ALIGHT_NUM>17875</TWENTY_TWO_ALIGHT_NUM> <TWENTY_THREE_RIDE_NUM>2199</TWENTY_THREE_RIDE_NUM> <TWENTY_THREE_ALIGHT_NUM>7010</TWENTY_THREE_ALIGHT_NUM> <MIDNIGHT_RIDE_NUM>15</MIDNIGHT_RIDE_NUM> <MIDNIGHT_ALIGHT_NUM>784</MIDNIGHT_ALIGHT_NUM> <ONE_RIDE_NUM>1</ONE_RIDE_NUM> <ONE_ALIGHT_NUM>0</ONE_ALIGHT_NUM> <TWO_RIDE_NUM>0</TWO_RIDE_NUM> <TWO_ALIGHT_NUM>0</TWO_ALIGHT_NUM> <THREE_RIDE_NUM>0</THREE_RIDE_NUM> <THREE_ALIGHT_NUM>0</THREE_ALIGHT_NUM> <WORK_DT>20210703</WORK_DT> </row> </CardSubwayTime>
JSON¶
_type='json'
_api="/".join([_url,_key,_type,_service,str(_start_index),str(_end_index),_use_mon])
data=requests.get(_api).text
# JSON Parsing
import json
jsubwayTime = json.loads(data)
j0=jsubwayTime['CardSubwayTime']['row'][0]
j0.keys() #Dic Keys
dict_keys(['USE_MON', 'LINE_NUM', 'SUB_STA_NM', 'FOUR_RIDE_NUM', 'FOUR_ALIGHT_NUM', 'FIVE_RIDE_NUM', 'FIVE_ALIGHT_NUM', 'SIX_RIDE_NUM', 'SIX_ALIGHT_NUM', 'SEVEN_RIDE_NUM', 'SEVEN_ALIGHT_NUM', 'EIGHT_RIDE_NUM', 'EIGHT_ALIGHT_NUM', 'NINE_RIDE_NUM', 'NINE_ALIGHT_NUM', 'TEN_RIDE_NUM', 'TEN_ALIGHT_NUM', 'ELEVEN_RIDE_NUM', 'ELEVEN_ALIGHT_NUM', 'TWELVE_RIDE_NUM', 'TWELVE_ALIGHT_NUM', 'THIRTEEN_RIDE_NUM', 'THIRTEEN_ALIGHT_NUM', 'FOURTEEN_RIDE_NUM', 'FOURTEEN_ALIGHT_NUM', 'FIFTEEN_RIDE_NUM', 'FIFTEEN_ALIGHT_NUM', 'SIXTEEN_RIDE_NUM', 'SIXTEEN_ALIGHT_NUM', 'SEVENTEEN_RIDE_NUM', 'SEVENTEEN_ALIGHT_NUM', 'EIGHTEEN_RIDE_NUM', 'EIGHTEEN_ALIGHT_NUM', 'NINETEEN_RIDE_NUM', 'NINETEEN_ALIGHT_NUM', 'TWENTY_RIDE_NUM', 'TWENTY_ALIGHT_NUM', 'TWENTY_ONE_RIDE_NUM', 'TWENTY_ONE_ALIGHT_NUM', 'TWENTY_TWO_RIDE_NUM', 'TWENTY_TWO_ALIGHT_NUM', 'TWENTY_THREE_RIDE_NUM', 'TWENTY_THREE_ALIGHT_NUM', 'MIDNIGHT_RIDE_NUM', 'MIDNIGHT_ALIGHT_NUM', 'ONE_RIDE_NUM', 'ONE_ALIGHT_NUM', 'TWO_RIDE_NUM', 'TWO_ALIGHT_NUM', 'THREE_RIDE_NUM', 'THREE_ALIGHT_NUM', 'WORK_DT'])
for item in jsubwayTime['CardSubwayTime']['row']:
print(item.values()) #Dic Values
dict_values(['202106', '2호선', '시청', 14.0, 1.0, 842.0, 1763.0, 1860.0, 14975.0, 4613.0, 64814.0, 6633.0, 200414.0, 8802.0, 77430.0, 11360.0, 22797.0, 16922.0, 19360.0, 17020.0, 18897.0, 21198.0, 20182.0, 25371.0, 17294.0, 30010.0, 15601.0, 35093.0, 13175.0, 75625.0, 14559.0, 161483.0, 15107.0, 49943.0, 7260.0, 34005.0, 3595.0, 34984.0, 3606.0, 25529.0, 3849.0, 3207.0, 1524.0, 1.0, 59.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, '20210703']) dict_values(['202106', '2호선', '을지로입구', 64.0, 3.0, 1704.0, 2012.0, 2899.0, 28884.0, 7675.0, 117998.0, 13246.0, 291410.0, 13992.0, 135503.0, 16743.0, 58638.0, 25033.0, 49654.0, 30391.0, 41996.0, 40023.0, 41126.0, 45420.0, 35619.0, 54603.0, 31053.0, 66615.0, 31408.0, 137169.0, 34407.0, 239134.0, 39521.0, 92855.0, 19653.0, 80662.0, 10659.0, 56892.0, 10478.0, 45993.0, 11575.0, 6249.0, 3586.0, 4.0, 1586.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, '20210703']) dict_values(['202106', '2호선', '을지로3가', 9.0, 1.0, 911.0, 1683.0, 1978.0, 18284.0, 5137.0, 64623.0, 8881.0, 153068.0, 9900.0, 66142.0, 11150.0, 28314.0, 15465.0, 22983.0, 17546.0, 21996.0, 20753.0, 23968.0, 23742.0, 21648.0, 27235.0, 19893.0, 34568.0, 21667.0, 73521.0, 25618.0, 128972.0, 30721.0, 49903.0, 15190.0, 34156.0, 6682.0, 45363.0, 5165.0, 45271.0, 5662.0, 5310.0, 1908.0, 2.0, 179.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, '20210703']) dict_values(['202106', '2호선', '을지로4가', 5.0, 0.0, 945.0, 1253.0, 1506.0, 13007.0, 3094.0, 33019.0, 5920.0, 78686.0, 6472.0, 40328.0, 8712.0, 21851.0, 11935.0, 19888.0, 14213.0, 17415.0, 16034.0, 17100.0, 18706.0, 15888.0, 21799.0, 14165.0, 25795.0, 12718.0, 50671.0, 11832.0, 69279.0, 11436.0, 29431.0, 5982.0, 15595.0, 2993.0, 13658.0, 2915.0, 11588.0, 3402.0, 2086.0, 1294.0, 2.0, 108.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, '20210703']) dict_values(['202106', '2호선', '동대문역사문화공원(DDP)', 334.0, 5.0, 6338.0, 1096.0, 4462.0, 7728.0, 6190.0, 23936.0, 9136.0, 50285.0, 9118.0, 29711.0, 10107.0, 23521.0, 13110.0, 24484.0, 15181.0, 21251.0, 16607.0, 21216.0, 19514.0, 20831.0, 25306.0, 18746.0, 30356.0, 16448.0, 36618.0, 17178.0, 40202.0, 19893.0, 23199.0, 20875.0, 17109.0, 13169.0, 19484.0, 10321.0, 14614.0, 10220.0, 4046.0, 5848.0, 3.0, 362.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, '20210703'])
문제 6: 지하철역 승하차 인원 수집, 저장¶
앞에서 상호작용 방식으로 작성했던 코드를 일괄 실행하고, 검색결과를 저장해보자.
지난 코드에서는 화면출력만 해보았으나, 파일이나 mongodb로 저장해보자.
%%writefile src/ds_open_subwayTime.py
# coding: utf-8
import os
import requests
import json
from pymongo import MongoClient
import mylib
# JSON 파일 저장하기
def saveJson(_fname,_data):
import io
with io.open(_fname, 'a', encoding='utf8') as json_file:
#_j=json.dumps(_data, json_file, ensure_ascii=False, encoding='utf8') # python2
_j=json.dump(_data, json_file, ensure_ascii=False)
json_file.write(str(_j)+"\n")
def readJson(_fname):
for line in open(_fname, 'r').readlines():
_j=json.loads(line)
#print _j['id'],_j['text']
print (_j['id'])
# 데이터베이스에 저장하기
def saveDB(_table, _data):
_table.insert_one(_data)
# Update Required: tweet -> ds_open_subwayPassengersDb
def readDB(_table):
for tweet in _table.find():
print (tweet['id'], tweet['text'])
def saveFile(_fname,_data):
fp=open(_fname,'a')
fp.write(_data+"\n")
fp.close()
def doIt():
# 1. Key.properties 가져오기
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=mylib.getKey(keyPath)
# 2. mongodb connect
mongo_pwd = key['mongo']
uriCloud = f'mongodb+srv://sjh9708:{mongo_pwd}@mycluster.tfiobq6.mongodb.net/?retryWrites=true&w=majority'
Client = MongoClient(uriCloud)
_db=Client['ds_open_subwayPassengersDb'] #db created by mongo. You do not have to create this.
_table=_db['db_open_subwayTable'] #collection
# 3. 저장할 JSON 파일명
_jfname='src/ds_open_subwayTime.json'
# 4. OpenAPI dataseoul에서 수집
_key=key['dataseoul'] #KEY='73725.....'
_url='http://openAPI.seoul.go.kr:8088'
_type='json'
_service='CardSubwayTime'
_start_index=1
_end_index=5
_use_mon='202106'
_maxIter=2 #20
_iter=0
while _iter<_maxIter:
# 5. API URL 작성
_api="/".join([_url,_key,_type,_service,str(_start_index),str(_end_index),_use_mon])
# 6. API 요청
r=requests.get(_api)
# 7. JSON Parsing
_json=r.json()
print (_json)
# 8. JSON 파일 / MongoDB에 JSON 저장
saveJson(_jfname,_json)
saveDB(_table, _json)
_start_index+=5
_end_index+=5
_iter+=1
if __name__ == "__main__":
doIt()
Overwriting src/ds_open_subwayTime.py
!python3 src/ds_open_subwayTime.py
{'CardSubwayTime': {'list_total_count': 608, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '서울역', 'FOUR_RIDE_NUM': 654.0, 'FOUR_ALIGHT_NUM': 17.0, 'FIVE_RIDE_NUM': 9008.0, 'FIVE_ALIGHT_NUM': 6400.0, 'SIX_RIDE_NUM': 12474.0, 'SIX_ALIGHT_NUM': 37203.0, 'SEVEN_RIDE_NUM': 37253.0, 'SEVEN_ALIGHT_NUM': 91875.0, 'EIGHT_RIDE_NUM': 59876.0, 'EIGHT_ALIGHT_NUM': 187805.0, 'NINE_RIDE_NUM': 44619.0, 'NINE_ALIGHT_NUM': 118679.0, 'TEN_RIDE_NUM': 42611.0, 'TEN_ALIGHT_NUM': 57710.0, 'ELEVEN_RIDE_NUM': 49533.0, 'ELEVEN_ALIGHT_NUM': 50003.0, 'TWELVE_RIDE_NUM': 59357.0, 'TWELVE_ALIGHT_NUM': 53317.0, 'THIRTEEN_RIDE_NUM': 61171.0, 'THIRTEEN_ALIGHT_NUM': 53687.0, 'FOURTEEN_RIDE_NUM': 53310.0, 'FOURTEEN_ALIGHT_NUM': 49094.0, 'FIFTEEN_RIDE_NUM': 65767.0, 'FIFTEEN_ALIGHT_NUM': 52788.0, 'SIXTEEN_RIDE_NUM': 76249.0, 'SIXTEEN_ALIGHT_NUM': 53969.0, 'SEVENTEEN_RIDE_NUM': 122928.0, 'SEVENTEEN_ALIGHT_NUM': 64693.0, 'EIGHTEEN_RIDE_NUM': 184907.0, 'EIGHTEEN_ALIGHT_NUM': 73978.0, 'NINETEEN_RIDE_NUM': 87575.0, 'NINETEEN_ALIGHT_NUM': 46769.0, 'TWENTY_RIDE_NUM': 59961.0, 'TWENTY_ALIGHT_NUM': 30743.0, 'TWENTY_ONE_RIDE_NUM': 65078.0, 'TWENTY_ONE_ALIGHT_NUM': 27435.0, 'TWENTY_TWO_RIDE_NUM': 44921.0, 'TWENTY_TWO_ALIGHT_NUM': 22829.0, 'TWENTY_THREE_RIDE_NUM': 11581.0, 'TWENTY_THREE_ALIGHT_NUM': 8024.0, 'MIDNIGHT_RIDE_NUM': 30.0, 'MIDNIGHT_ALIGHT_NUM': 637.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 1.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '동묘앞', 'FOUR_RIDE_NUM': 51.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 3218.0, 'FIVE_ALIGHT_NUM': 1100.0, 'SIX_RIDE_NUM': 3422.0, 'SIX_ALIGHT_NUM': 4802.0, 'SEVEN_RIDE_NUM': 5896.0, 'SEVEN_ALIGHT_NUM': 9703.0, 'EIGHT_RIDE_NUM': 9194.0, 'EIGHT_ALIGHT_NUM': 24921.0, 'NINE_RIDE_NUM': 8022.0, 'NINE_ALIGHT_NUM': 17333.0, 'TEN_RIDE_NUM': 9687.0, 'TEN_ALIGHT_NUM': 19292.0, 'ELEVEN_RIDE_NUM': 14091.0, 'ELEVEN_ALIGHT_NUM': 24305.0, 'TWELVE_RIDE_NUM': 20089.0, 'TWELVE_ALIGHT_NUM': 26186.0, 'THIRTEEN_RIDE_NUM': 24776.0, 'THIRTEEN_ALIGHT_NUM': 28141.0, 'FOURTEEN_RIDE_NUM': 27144.0, 'FOURTEEN_ALIGHT_NUM': 26643.0, 'FIFTEEN_RIDE_NUM': 28360.0, 'FIFTEEN_ALIGHT_NUM': 23213.0, 'SIXTEEN_RIDE_NUM': 31119.0, 'SIXTEEN_ALIGHT_NUM': 17744.0, 'SEVENTEEN_RIDE_NUM': 27036.0, 'SEVENTEEN_ALIGHT_NUM': 13759.0, 'EIGHTEEN_RIDE_NUM': 23606.0, 'EIGHTEEN_ALIGHT_NUM': 10098.0, 'NINETEEN_RIDE_NUM': 11006.0, 'NINETEEN_ALIGHT_NUM': 6510.0, 'TWENTY_RIDE_NUM': 6119.0, 'TWENTY_ALIGHT_NUM': 4409.0, 'TWENTY_ONE_RIDE_NUM': 5485.0, 'TWENTY_ONE_ALIGHT_NUM': 4265.0, 'TWENTY_TWO_RIDE_NUM': 3405.0, 'TWENTY_TWO_ALIGHT_NUM': 5689.0, 'TWENTY_THREE_RIDE_NUM': 1035.0, 'TWENTY_THREE_ALIGHT_NUM': 2589.0, 'MIDNIGHT_RIDE_NUM': 4.0, 'MIDNIGHT_ALIGHT_NUM': 1348.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '시청', 'FOUR_RIDE_NUM': 37.0, 'FOUR_ALIGHT_NUM': 0.0, 'FIVE_RIDE_NUM': 1881.0, 'FIVE_ALIGHT_NUM': 4340.0, 'SIX_RIDE_NUM': 2948.0, 'SIX_ALIGHT_NUM': 21443.0, 'SEVEN_RIDE_NUM': 6280.0, 'SEVEN_ALIGHT_NUM': 62346.0, 'EIGHT_RIDE_NUM': 7740.0, 'EIGHT_ALIGHT_NUM': 167991.0, 'NINE_RIDE_NUM': 8117.0, 'NINE_ALIGHT_NUM': 72853.0, 'TEN_RIDE_NUM': 9284.0, 'TEN_ALIGHT_NUM': 29250.0, 'ELEVEN_RIDE_NUM': 14030.0, 'ELEVEN_ALIGHT_NUM': 27989.0, 'TWELVE_RIDE_NUM': 15295.0, 'TWELVE_ALIGHT_NUM': 25037.0, 'THIRTEEN_RIDE_NUM': 18849.0, 'THIRTEEN_ALIGHT_NUM': 24492.0, 'FOURTEEN_RIDE_NUM': 23331.0, 'FOURTEEN_ALIGHT_NUM': 20032.0, 'FIFTEEN_RIDE_NUM': 30469.0, 'FIFTEEN_ALIGHT_NUM': 17869.0, 'SIXTEEN_RIDE_NUM': 36116.0, 'SIXTEEN_ALIGHT_NUM': 15593.0, 'SEVENTEEN_RIDE_NUM': 66595.0, 'SEVENTEEN_ALIGHT_NUM': 16611.0, 'EIGHTEEN_RIDE_NUM': 135842.0, 'EIGHTEEN_ALIGHT_NUM': 17805.0, 'NINETEEN_RIDE_NUM': 46850.0, 'NINETEEN_ALIGHT_NUM': 8139.0, 'TWENTY_RIDE_NUM': 38173.0, 'TWENTY_ALIGHT_NUM': 4455.0, 'TWENTY_ONE_RIDE_NUM': 39048.0, 'TWENTY_ONE_ALIGHT_NUM': 4234.0, 'TWENTY_TWO_RIDE_NUM': 28501.0, 'TWENTY_TWO_ALIGHT_NUM': 3686.0, 'TWENTY_THREE_RIDE_NUM': 4390.0, 'TWENTY_THREE_ALIGHT_NUM': 1485.0, 'MIDNIGHT_RIDE_NUM': 3.0, 'MIDNIGHT_ALIGHT_NUM': 92.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종각', 'FOUR_RIDE_NUM': 127.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 2314.0, 'FIVE_ALIGHT_NUM': 4354.0, 'SIX_RIDE_NUM': 2868.0, 'SIX_ALIGHT_NUM': 23755.0, 'SEVEN_RIDE_NUM': 5479.0, 'SEVEN_ALIGHT_NUM': 96712.0, 'EIGHT_RIDE_NUM': 8419.0, 'EIGHT_ALIGHT_NUM': 223459.0, 'NINE_RIDE_NUM': 10625.0, 'NINE_ALIGHT_NUM': 131420.0, 'TEN_RIDE_NUM': 14727.0, 'TEN_ALIGHT_NUM': 50878.0, 'ELEVEN_RIDE_NUM': 23057.0, 'ELEVEN_ALIGHT_NUM': 44506.0, 'TWELVE_RIDE_NUM': 27707.0, 'TWELVE_ALIGHT_NUM': 39830.0, 'THIRTEEN_RIDE_NUM': 34538.0, 'THIRTEEN_ALIGHT_NUM': 40864.0, 'FOURTEEN_RIDE_NUM': 40378.0, 'FOURTEEN_ALIGHT_NUM': 33173.0, 'FIFTEEN_RIDE_NUM': 49745.0, 'FIFTEEN_ALIGHT_NUM': 29610.0, 'SIXTEEN_RIDE_NUM': 58664.0, 'SIXTEEN_ALIGHT_NUM': 29692.0, 'SEVENTEEN_RIDE_NUM': 114985.0, 'SEVENTEEN_ALIGHT_NUM': 33365.0, 'EIGHTEEN_RIDE_NUM': 192552.0, 'EIGHTEEN_ALIGHT_NUM': 39621.0, 'NINETEEN_RIDE_NUM': 78735.0, 'NINETEEN_ALIGHT_NUM': 19163.0, 'TWENTY_RIDE_NUM': 64989.0, 'TWENTY_ALIGHT_NUM': 7386.0, 'TWENTY_ONE_RIDE_NUM': 81179.0, 'TWENTY_ONE_ALIGHT_NUM': 4790.0, 'TWENTY_TWO_RIDE_NUM': 63653.0, 'TWENTY_TWO_ALIGHT_NUM': 3763.0, 'TWENTY_THREE_RIDE_NUM': 8153.0, 'TWENTY_THREE_ALIGHT_NUM': 1675.0, 'MIDNIGHT_RIDE_NUM': 21.0, 'MIDNIGHT_ALIGHT_NUM': 135.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로3가', 'FOUR_RIDE_NUM': 191.0, 'FOUR_ALIGHT_NUM': 24.0, 'FIVE_RIDE_NUM': 3227.0, 'FIVE_ALIGHT_NUM': 3388.0, 'SIX_RIDE_NUM': 3069.0, 'SIX_ALIGHT_NUM': 13080.0, 'SEVEN_RIDE_NUM': 5108.0, 'SEVEN_ALIGHT_NUM': 25462.0, 'EIGHT_RIDE_NUM': 7412.0, 'EIGHT_ALIGHT_NUM': 70639.0, 'NINE_RIDE_NUM': 11673.0, 'NINE_ALIGHT_NUM': 73336.0, 'TEN_RIDE_NUM': 18502.0, 'TEN_ALIGHT_NUM': 57312.0, 'ELEVEN_RIDE_NUM': 29882.0, 'ELEVEN_ALIGHT_NUM': 55725.0, 'TWELVE_RIDE_NUM': 37009.0, 'TWELVE_ALIGHT_NUM': 53678.0, 'THIRTEEN_RIDE_NUM': 44050.0, 'THIRTEEN_ALIGHT_NUM': 51189.0, 'FOURTEEN_RIDE_NUM': 47626.0, 'FOURTEEN_ALIGHT_NUM': 46621.0, 'FIFTEEN_RIDE_NUM': 53071.0, 'FIFTEEN_ALIGHT_NUM': 40250.0, 'SIXTEEN_RIDE_NUM': 56955.0, 'SIXTEEN_ALIGHT_NUM': 34679.0, 'SEVENTEEN_RIDE_NUM': 68711.0, 'SEVENTEEN_ALIGHT_NUM': 31234.0, 'EIGHTEEN_RIDE_NUM': 94683.0, 'EIGHTEEN_ALIGHT_NUM': 33315.0, 'NINETEEN_RIDE_NUM': 55993.0, 'NINETEEN_ALIGHT_NUM': 16571.0, 'TWENTY_RIDE_NUM': 41534.0, 'TWENTY_ALIGHT_NUM': 6332.0, 'TWENTY_ONE_RIDE_NUM': 51588.0, 'TWENTY_ONE_ALIGHT_NUM': 4938.0, 'TWENTY_TWO_RIDE_NUM': 47756.0, 'TWENTY_TWO_ALIGHT_NUM': 4591.0, 'TWENTY_THREE_RIDE_NUM': 6768.0, 'TWENTY_THREE_ALIGHT_NUM': 2318.0, 'MIDNIGHT_RIDE_NUM': 25.0, 'MIDNIGHT_ALIGHT_NUM': 413.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}]}} {'CardSubwayTime': {'list_total_count': 608, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로5가', 'FOUR_RIDE_NUM': 71.0, 'FOUR_ALIGHT_NUM': 0.0, 'FIVE_RIDE_NUM': 1526.0, 'FIVE_ALIGHT_NUM': 3779.0, 'SIX_RIDE_NUM': 2574.0, 'SIX_ALIGHT_NUM': 16992.0, 'SEVEN_RIDE_NUM': 4781.0, 'SEVEN_ALIGHT_NUM': 39423.0, 'EIGHT_RIDE_NUM': 7414.0, 'EIGHT_ALIGHT_NUM': 103060.0, 'NINE_RIDE_NUM': 11525.0, 'NINE_ALIGHT_NUM': 62717.0, 'TEN_RIDE_NUM': 18431.0, 'TEN_ALIGHT_NUM': 50987.0, 'ELEVEN_RIDE_NUM': 27735.0, 'ELEVEN_ALIGHT_NUM': 48857.0, 'TWELVE_RIDE_NUM': 34387.0, 'TWELVE_ALIGHT_NUM': 47295.0, 'THIRTEEN_RIDE_NUM': 40094.0, 'THIRTEEN_ALIGHT_NUM': 42416.0, 'FOURTEEN_RIDE_NUM': 46633.0, 'FOURTEEN_ALIGHT_NUM': 39899.0, 'FIFTEEN_RIDE_NUM': 50981.0, 'FIFTEEN_ALIGHT_NUM': 35861.0, 'SIXTEEN_RIDE_NUM': 55982.0, 'SIXTEEN_ALIGHT_NUM': 29188.0, 'SEVENTEEN_RIDE_NUM': 71386.0, 'SEVENTEEN_ALIGHT_NUM': 26232.0, 'EIGHTEEN_RIDE_NUM': 96880.0, 'EIGHTEEN_ALIGHT_NUM': 22727.0, 'NINETEEN_RIDE_NUM': 45846.0, 'NINETEEN_ALIGHT_NUM': 12621.0, 'TWENTY_RIDE_NUM': 29493.0, 'TWENTY_ALIGHT_NUM': 5474.0, 'TWENTY_ONE_RIDE_NUM': 29266.0, 'TWENTY_ONE_ALIGHT_NUM': 4184.0, 'TWENTY_TWO_RIDE_NUM': 20319.0, 'TWENTY_TWO_ALIGHT_NUM': 3607.0, 'TWENTY_THREE_RIDE_NUM': 2740.0, 'TWENTY_THREE_ALIGHT_NUM': 1681.0, 'MIDNIGHT_RIDE_NUM': 4.0, 'MIDNIGHT_ALIGHT_NUM': 268.0, 'ONE_RIDE_NUM': 1.0, 'ONE_ALIGHT_NUM': 1.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '동대문', 'FOUR_RIDE_NUM': 715.0, 'FOUR_ALIGHT_NUM': 14.0, 'FIVE_RIDE_NUM': 13235.0, 'FIVE_ALIGHT_NUM': 2131.0, 'SIX_RIDE_NUM': 8936.0, 'SIX_ALIGHT_NUM': 6979.0, 'SEVEN_RIDE_NUM': 14776.0, 'SEVEN_ALIGHT_NUM': 12395.0, 'EIGHT_RIDE_NUM': 18660.0, 'EIGHT_ALIGHT_NUM': 24732.0, 'NINE_RIDE_NUM': 16788.0, 'NINE_ALIGHT_NUM': 22866.0, 'TEN_RIDE_NUM': 15988.0, 'TEN_ALIGHT_NUM': 21388.0, 'ELEVEN_RIDE_NUM': 17257.0, 'ELEVEN_ALIGHT_NUM': 22109.0, 'TWELVE_RIDE_NUM': 20561.0, 'TWELVE_ALIGHT_NUM': 21732.0, 'THIRTEEN_RIDE_NUM': 21099.0, 'THIRTEEN_ALIGHT_NUM': 20786.0, 'FOURTEEN_RIDE_NUM': 22318.0, 'FOURTEEN_ALIGHT_NUM': 19616.0, 'FIFTEEN_RIDE_NUM': 23370.0, 'FIFTEEN_ALIGHT_NUM': 18703.0, 'SIXTEEN_RIDE_NUM': 24338.0, 'SIXTEEN_ALIGHT_NUM': 17325.0, 'SEVENTEEN_RIDE_NUM': 23923.0, 'SEVENTEEN_ALIGHT_NUM': 17672.0, 'EIGHTEEN_RIDE_NUM': 22895.0, 'EIGHTEEN_ALIGHT_NUM': 18354.0, 'NINETEEN_RIDE_NUM': 15871.0, 'NINETEEN_ALIGHT_NUM': 19089.0, 'TWENTY_RIDE_NUM': 12693.0, 'TWENTY_ALIGHT_NUM': 12789.0, 'TWENTY_ONE_RIDE_NUM': 13040.0, 'TWENTY_ONE_ALIGHT_NUM': 10134.0, 'TWENTY_TWO_RIDE_NUM': 11167.0, 'TWENTY_TWO_ALIGHT_NUM': 10601.0, 'TWENTY_THREE_RIDE_NUM': 2811.0, 'TWENTY_THREE_ALIGHT_NUM': 8211.0, 'MIDNIGHT_RIDE_NUM': 16.0, 'MIDNIGHT_ALIGHT_NUM': 1434.0, 'ONE_RIDE_NUM': 1.0, 'ONE_ALIGHT_NUM': 1.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '신설동', 'FOUR_RIDE_NUM': 343.0, 'FOUR_ALIGHT_NUM': 3.0, 'FIVE_RIDE_NUM': 8150.0, 'FIVE_ALIGHT_NUM': 3192.0, 'SIX_RIDE_NUM': 8131.0, 'SIX_ALIGHT_NUM': 10929.0, 'SEVEN_RIDE_NUM': 17021.0, 'SEVEN_ALIGHT_NUM': 25745.0, 'EIGHT_RIDE_NUM': 24583.0, 'EIGHT_ALIGHT_NUM': 62999.0, 'NINE_RIDE_NUM': 16472.0, 'NINE_ALIGHT_NUM': 33400.0, 'TEN_RIDE_NUM': 14689.0, 'TEN_ALIGHT_NUM': 20639.0, 'ELEVEN_RIDE_NUM': 16427.0, 'ELEVEN_ALIGHT_NUM': 17238.0, 'TWELVE_RIDE_NUM': 17625.0, 'TWELVE_ALIGHT_NUM': 16913.0, 'THIRTEEN_RIDE_NUM': 19712.0, 'THIRTEEN_ALIGHT_NUM': 17440.0, 'FOURTEEN_RIDE_NUM': 19363.0, 'FOURTEEN_ALIGHT_NUM': 16063.0, 'FIFTEEN_RIDE_NUM': 20684.0, 'FIFTEEN_ALIGHT_NUM': 16772.0, 'SIXTEEN_RIDE_NUM': 28784.0, 'SIXTEEN_ALIGHT_NUM': 17481.0, 'SEVENTEEN_RIDE_NUM': 39357.0, 'SEVENTEEN_ALIGHT_NUM': 20038.0, 'EIGHTEEN_RIDE_NUM': 57642.0, 'EIGHTEEN_ALIGHT_NUM': 25012.0, 'NINETEEN_RIDE_NUM': 20823.0, 'NINETEEN_ALIGHT_NUM': 17529.0, 'TWENTY_RIDE_NUM': 13880.0, 'TWENTY_ALIGHT_NUM': 10932.0, 'TWENTY_ONE_RIDE_NUM': 13378.0, 'TWENTY_ONE_ALIGHT_NUM': 10102.0, 'TWENTY_TWO_RIDE_NUM': 10189.0, 'TWENTY_TWO_ALIGHT_NUM': 11809.0, 'TWENTY_THREE_RIDE_NUM': 1952.0, 'TWENTY_THREE_ALIGHT_NUM': 5451.0, 'MIDNIGHT_RIDE_NUM': 10.0, 'MIDNIGHT_ALIGHT_NUM': 449.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '제기동', 'FOUR_RIDE_NUM': 360.0, 'FOUR_ALIGHT_NUM': 3.0, 'FIVE_RIDE_NUM': 5020.0, 'FIVE_ALIGHT_NUM': 2150.0, 'SIX_RIDE_NUM': 8625.0, 'SIX_ALIGHT_NUM': 9488.0, 'SEVEN_RIDE_NUM': 21818.0, 'SEVEN_ALIGHT_NUM': 18800.0, 'EIGHT_RIDE_NUM': 31428.0, 'EIGHT_ALIGHT_NUM': 42110.0, 'NINE_RIDE_NUM': 22254.0, 'NINE_ALIGHT_NUM': 37145.0, 'TEN_RIDE_NUM': 25534.0, 'TEN_ALIGHT_NUM': 39572.0, 'ELEVEN_RIDE_NUM': 33701.0, 'ELEVEN_ALIGHT_NUM': 40192.0, 'TWELVE_RIDE_NUM': 37380.0, 'TWELVE_ALIGHT_NUM': 36944.0, 'THIRTEEN_RIDE_NUM': 37913.0, 'THIRTEEN_ALIGHT_NUM': 36302.0, 'FOURTEEN_RIDE_NUM': 38816.0, 'FOURTEEN_ALIGHT_NUM': 38060.0, 'FIFTEEN_RIDE_NUM': 39042.0, 'FIFTEEN_ALIGHT_NUM': 34744.0, 'SIXTEEN_RIDE_NUM': 36805.0, 'SIXTEEN_ALIGHT_NUM': 29316.0, 'SEVENTEEN_RIDE_NUM': 38480.0, 'SEVENTEEN_ALIGHT_NUM': 23319.0, 'EIGHTEEN_RIDE_NUM': 37172.0, 'EIGHTEEN_ALIGHT_NUM': 26182.0, 'NINETEEN_RIDE_NUM': 16542.0, 'NINETEEN_ALIGHT_NUM': 17773.0, 'TWENTY_RIDE_NUM': 10447.0, 'TWENTY_ALIGHT_NUM': 11211.0, 'TWENTY_ONE_RIDE_NUM': 8822.0, 'TWENTY_ONE_ALIGHT_NUM': 10198.0, 'TWENTY_TWO_RIDE_NUM': 7253.0, 'TWENTY_TWO_ALIGHT_NUM': 11830.0, 'TWENTY_THREE_RIDE_NUM': 2042.0, 'TWENTY_THREE_ALIGHT_NUM': 4844.0, 'MIDNIGHT_RIDE_NUM': 8.0, 'MIDNIGHT_ALIGHT_NUM': 408.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 1.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '청량리(서울시립대입구)', 'FOUR_RIDE_NUM': 1114.0, 'FOUR_ALIGHT_NUM': 17.0, 'FIVE_RIDE_NUM': 10556.0, 'FIVE_ALIGHT_NUM': 4752.0, 'SIX_RIDE_NUM': 14555.0, 'SIX_ALIGHT_NUM': 20601.0, 'SEVEN_RIDE_NUM': 36398.0, 'SEVEN_ALIGHT_NUM': 18127.0, 'EIGHT_RIDE_NUM': 44314.0, 'EIGHT_ALIGHT_NUM': 36112.0, 'NINE_RIDE_NUM': 30993.0, 'NINE_ALIGHT_NUM': 33651.0, 'TEN_RIDE_NUM': 30325.0, 'TEN_ALIGHT_NUM': 34593.0, 'ELEVEN_RIDE_NUM': 32895.0, 'ELEVEN_ALIGHT_NUM': 36922.0, 'TWELVE_RIDE_NUM': 36644.0, 'TWELVE_ALIGHT_NUM': 38152.0, 'THIRTEEN_RIDE_NUM': 37957.0, 'THIRTEEN_ALIGHT_NUM': 37161.0, 'FOURTEEN_RIDE_NUM': 38453.0, 'FOURTEEN_ALIGHT_NUM': 41488.0, 'FIFTEEN_RIDE_NUM': 41308.0, 'FIFTEEN_ALIGHT_NUM': 40046.0, 'SIXTEEN_RIDE_NUM': 48019.0, 'SIXTEEN_ALIGHT_NUM': 37625.0, 'SEVENTEEN_RIDE_NUM': 45267.0, 'SEVENTEEN_ALIGHT_NUM': 37535.0, 'EIGHTEEN_RIDE_NUM': 41132.0, 'EIGHTEEN_ALIGHT_NUM': 46814.0, 'NINETEEN_RIDE_NUM': 22408.0, 'NINETEEN_ALIGHT_NUM': 31284.0, 'TWENTY_RIDE_NUM': 16802.0, 'TWENTY_ALIGHT_NUM': 17867.0, 'TWENTY_ONE_RIDE_NUM': 13163.0, 'TWENTY_ONE_ALIGHT_NUM': 16739.0, 'TWENTY_TWO_RIDE_NUM': 9007.0, 'TWENTY_TWO_ALIGHT_NUM': 17875.0, 'TWENTY_THREE_RIDE_NUM': 2199.0, 'TWENTY_THREE_ALIGHT_NUM': 7010.0, 'MIDNIGHT_RIDE_NUM': 15.0, 'MIDNIGHT_ALIGHT_NUM': 784.0, 'ONE_RIDE_NUM': 1.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}]}}
!ls -l src/ds_open_subwayTime*
-rw-r--r-- 1 sojaehwi staff 96834 Nov 27 05:51 src/ds_open_subwayTime.json -rw-r--r-- 1 sojaehwi staff 2267 Nov 27 05:51 src/ds_open_subwayTime.py
데이터베이스 확인¶
db=Client.ds_open_subwayPassengersDb
db.list_collection_names()
['db_open_subwayTable']
db.db_open_subwayTable.count_documents({})
12
db.db_open_subwayTable.find_one() # 한 건 출력
{'_id': ObjectId('6528f7cfd614ea37caa2ad28'), 'CardSubwayTime': {'list_total_count': 608, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '서울역', 'FOUR_RIDE_NUM': 654.0, 'FOUR_ALIGHT_NUM': 17.0, 'FIVE_RIDE_NUM': 9008.0, 'FIVE_ALIGHT_NUM': 6400.0, 'SIX_RIDE_NUM': 12474.0, 'SIX_ALIGHT_NUM': 37203.0, 'SEVEN_RIDE_NUM': 37253.0, 'SEVEN_ALIGHT_NUM': 91875.0, 'EIGHT_RIDE_NUM': 59876.0, 'EIGHT_ALIGHT_NUM': 187805.0, 'NINE_RIDE_NUM': 44619.0, 'NINE_ALIGHT_NUM': 118679.0, 'TEN_RIDE_NUM': 42611.0, 'TEN_ALIGHT_NUM': 57710.0, 'ELEVEN_RIDE_NUM': 49533.0, 'ELEVEN_ALIGHT_NUM': 50003.0, 'TWELVE_RIDE_NUM': 59357.0, 'TWELVE_ALIGHT_NUM': 53317.0, 'THIRTEEN_RIDE_NUM': 61171.0, 'THIRTEEN_ALIGHT_NUM': 53687.0, 'FOURTEEN_RIDE_NUM': 53310.0, 'FOURTEEN_ALIGHT_NUM': 49094.0, 'FIFTEEN_RIDE_NUM': 65767.0, 'FIFTEEN_ALIGHT_NUM': 52788.0, 'SIXTEEN_RIDE_NUM': 76249.0, 'SIXTEEN_ALIGHT_NUM': 53969.0, 'SEVENTEEN_RIDE_NUM': 122928.0, 'SEVENTEEN_ALIGHT_NUM': 64693.0, 'EIGHTEEN_RIDE_NUM': 184907.0, 'EIGHTEEN_ALIGHT_NUM': 73978.0, 'NINETEEN_RIDE_NUM': 87575.0, 'NINETEEN_ALIGHT_NUM': 46769.0, 'TWENTY_RIDE_NUM': 59961.0, 'TWENTY_ALIGHT_NUM': 30743.0, 'TWENTY_ONE_RIDE_NUM': 65078.0, 'TWENTY_ONE_ALIGHT_NUM': 27435.0, 'TWENTY_TWO_RIDE_NUM': 44921.0, 'TWENTY_TWO_ALIGHT_NUM': 22829.0, 'TWENTY_THREE_RIDE_NUM': 11581.0, 'TWENTY_THREE_ALIGHT_NUM': 8024.0, 'MIDNIGHT_RIDE_NUM': 30.0, 'MIDNIGHT_ALIGHT_NUM': 637.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 1.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '동묘앞', 'FOUR_RIDE_NUM': 51.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 3218.0, 'FIVE_ALIGHT_NUM': 1100.0, 'SIX_RIDE_NUM': 3422.0, 'SIX_ALIGHT_NUM': 4802.0, 'SEVEN_RIDE_NUM': 5896.0, 'SEVEN_ALIGHT_NUM': 9703.0, 'EIGHT_RIDE_NUM': 9194.0, 'EIGHT_ALIGHT_NUM': 24921.0, 'NINE_RIDE_NUM': 8022.0, 'NINE_ALIGHT_NUM': 17333.0, 'TEN_RIDE_NUM': 9687.0, 'TEN_ALIGHT_NUM': 19292.0, 'ELEVEN_RIDE_NUM': 14091.0, 'ELEVEN_ALIGHT_NUM': 24305.0, 'TWELVE_RIDE_NUM': 20089.0, 'TWELVE_ALIGHT_NUM': 26186.0, 'THIRTEEN_RIDE_NUM': 24776.0, 'THIRTEEN_ALIGHT_NUM': 28141.0, 'FOURTEEN_RIDE_NUM': 27144.0, 'FOURTEEN_ALIGHT_NUM': 26643.0, 'FIFTEEN_RIDE_NUM': 28360.0, 'FIFTEEN_ALIGHT_NUM': 23213.0, 'SIXTEEN_RIDE_NUM': 31119.0, 'SIXTEEN_ALIGHT_NUM': 17744.0, 'SEVENTEEN_RIDE_NUM': 27036.0, 'SEVENTEEN_ALIGHT_NUM': 13759.0, 'EIGHTEEN_RIDE_NUM': 23606.0, 'EIGHTEEN_ALIGHT_NUM': 10098.0, 'NINETEEN_RIDE_NUM': 11006.0, 'NINETEEN_ALIGHT_NUM': 6510.0, 'TWENTY_RIDE_NUM': 6119.0, 'TWENTY_ALIGHT_NUM': 4409.0, 'TWENTY_ONE_RIDE_NUM': 5485.0, 'TWENTY_ONE_ALIGHT_NUM': 4265.0, 'TWENTY_TWO_RIDE_NUM': 3405.0, 'TWENTY_TWO_ALIGHT_NUM': 5689.0, 'TWENTY_THREE_RIDE_NUM': 1035.0, 'TWENTY_THREE_ALIGHT_NUM': 2589.0, 'MIDNIGHT_RIDE_NUM': 4.0, 'MIDNIGHT_ALIGHT_NUM': 1348.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '시청', 'FOUR_RIDE_NUM': 37.0, 'FOUR_ALIGHT_NUM': 0.0, 'FIVE_RIDE_NUM': 1881.0, 'FIVE_ALIGHT_NUM': 4340.0, 'SIX_RIDE_NUM': 2948.0, 'SIX_ALIGHT_NUM': 21443.0, 'SEVEN_RIDE_NUM': 6280.0, 'SEVEN_ALIGHT_NUM': 62346.0, 'EIGHT_RIDE_NUM': 7740.0, 'EIGHT_ALIGHT_NUM': 167991.0, 'NINE_RIDE_NUM': 8117.0, 'NINE_ALIGHT_NUM': 72853.0, 'TEN_RIDE_NUM': 9284.0, 'TEN_ALIGHT_NUM': 29250.0, 'ELEVEN_RIDE_NUM': 14030.0, 'ELEVEN_ALIGHT_NUM': 27989.0, 'TWELVE_RIDE_NUM': 15295.0, 'TWELVE_ALIGHT_NUM': 25037.0, 'THIRTEEN_RIDE_NUM': 18849.0, 'THIRTEEN_ALIGHT_NUM': 24492.0, 'FOURTEEN_RIDE_NUM': 23331.0, 'FOURTEEN_ALIGHT_NUM': 20032.0, 'FIFTEEN_RIDE_NUM': 30469.0, 'FIFTEEN_ALIGHT_NUM': 17869.0, 'SIXTEEN_RIDE_NUM': 36116.0, 'SIXTEEN_ALIGHT_NUM': 15593.0, 'SEVENTEEN_RIDE_NUM': 66595.0, 'SEVENTEEN_ALIGHT_NUM': 16611.0, 'EIGHTEEN_RIDE_NUM': 135842.0, 'EIGHTEEN_ALIGHT_NUM': 17805.0, 'NINETEEN_RIDE_NUM': 46850.0, 'NINETEEN_ALIGHT_NUM': 8139.0, 'TWENTY_RIDE_NUM': 38173.0, 'TWENTY_ALIGHT_NUM': 4455.0, 'TWENTY_ONE_RIDE_NUM': 39048.0, 'TWENTY_ONE_ALIGHT_NUM': 4234.0, 'TWENTY_TWO_RIDE_NUM': 28501.0, 'TWENTY_TWO_ALIGHT_NUM': 3686.0, 'TWENTY_THREE_RIDE_NUM': 4390.0, 'TWENTY_THREE_ALIGHT_NUM': 1485.0, 'MIDNIGHT_RIDE_NUM': 3.0, 'MIDNIGHT_ALIGHT_NUM': 92.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종각', 'FOUR_RIDE_NUM': 127.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 2314.0, 'FIVE_ALIGHT_NUM': 4354.0, 'SIX_RIDE_NUM': 2868.0, 'SIX_ALIGHT_NUM': 23755.0, 'SEVEN_RIDE_NUM': 5479.0, 'SEVEN_ALIGHT_NUM': 96712.0, 'EIGHT_RIDE_NUM': 8419.0, 'EIGHT_ALIGHT_NUM': 223459.0, 'NINE_RIDE_NUM': 10625.0, 'NINE_ALIGHT_NUM': 131420.0, 'TEN_RIDE_NUM': 14727.0, 'TEN_ALIGHT_NUM': 50878.0, 'ELEVEN_RIDE_NUM': 23057.0, 'ELEVEN_ALIGHT_NUM': 44506.0, 'TWELVE_RIDE_NUM': 27707.0, 'TWELVE_ALIGHT_NUM': 39830.0, 'THIRTEEN_RIDE_NUM': 34538.0, 'THIRTEEN_ALIGHT_NUM': 40864.0, 'FOURTEEN_RIDE_NUM': 40378.0, 'FOURTEEN_ALIGHT_NUM': 33173.0, 'FIFTEEN_RIDE_NUM': 49745.0, 'FIFTEEN_ALIGHT_NUM': 29610.0, 'SIXTEEN_RIDE_NUM': 58664.0, 'SIXTEEN_ALIGHT_NUM': 29692.0, 'SEVENTEEN_RIDE_NUM': 114985.0, 'SEVENTEEN_ALIGHT_NUM': 33365.0, 'EIGHTEEN_RIDE_NUM': 192552.0, 'EIGHTEEN_ALIGHT_NUM': 39621.0, 'NINETEEN_RIDE_NUM': 78735.0, 'NINETEEN_ALIGHT_NUM': 19163.0, 'TWENTY_RIDE_NUM': 64989.0, 'TWENTY_ALIGHT_NUM': 7386.0, 'TWENTY_ONE_RIDE_NUM': 81179.0, 'TWENTY_ONE_ALIGHT_NUM': 4790.0, 'TWENTY_TWO_RIDE_NUM': 63653.0, 'TWENTY_TWO_ALIGHT_NUM': 3763.0, 'TWENTY_THREE_RIDE_NUM': 8153.0, 'TWENTY_THREE_ALIGHT_NUM': 1675.0, 'MIDNIGHT_RIDE_NUM': 21.0, 'MIDNIGHT_ALIGHT_NUM': 135.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로3가', 'FOUR_RIDE_NUM': 191.0, 'FOUR_ALIGHT_NUM': 24.0, 'FIVE_RIDE_NUM': 3227.0, 'FIVE_ALIGHT_NUM': 3388.0, 'SIX_RIDE_NUM': 3069.0, 'SIX_ALIGHT_NUM': 13080.0, 'SEVEN_RIDE_NUM': 5108.0, 'SEVEN_ALIGHT_NUM': 25462.0, 'EIGHT_RIDE_NUM': 7412.0, 'EIGHT_ALIGHT_NUM': 70639.0, 'NINE_RIDE_NUM': 11673.0, 'NINE_ALIGHT_NUM': 73336.0, 'TEN_RIDE_NUM': 18502.0, 'TEN_ALIGHT_NUM': 57312.0, 'ELEVEN_RIDE_NUM': 29882.0, 'ELEVEN_ALIGHT_NUM': 55725.0, 'TWELVE_RIDE_NUM': 37009.0, 'TWELVE_ALIGHT_NUM': 53678.0, 'THIRTEEN_RIDE_NUM': 44050.0, 'THIRTEEN_ALIGHT_NUM': 51189.0, 'FOURTEEN_RIDE_NUM': 47626.0, 'FOURTEEN_ALIGHT_NUM': 46621.0, 'FIFTEEN_RIDE_NUM': 53071.0, 'FIFTEEN_ALIGHT_NUM': 40250.0, 'SIXTEEN_RIDE_NUM': 56955.0, 'SIXTEEN_ALIGHT_NUM': 34679.0, 'SEVENTEEN_RIDE_NUM': 68711.0, 'SEVENTEEN_ALIGHT_NUM': 31234.0, 'EIGHTEEN_RIDE_NUM': 94683.0, 'EIGHTEEN_ALIGHT_NUM': 33315.0, 'NINETEEN_RIDE_NUM': 55993.0, 'NINETEEN_ALIGHT_NUM': 16571.0, 'TWENTY_RIDE_NUM': 41534.0, 'TWENTY_ALIGHT_NUM': 6332.0, 'TWENTY_ONE_RIDE_NUM': 51588.0, 'TWENTY_ONE_ALIGHT_NUM': 4938.0, 'TWENTY_TWO_RIDE_NUM': 47756.0, 'TWENTY_TWO_ALIGHT_NUM': 4591.0, 'TWENTY_THREE_RIDE_NUM': 6768.0, 'TWENTY_THREE_ALIGHT_NUM': 2318.0, 'MIDNIGHT_RIDE_NUM': 25.0, 'MIDNIGHT_ALIGHT_NUM': 413.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}]}}
db.db_open_subwayTable.find_one({"CardSubwayTime.row.SUB_STA_NM":"서울역"}) # Where
{'_id': ObjectId('6528f7cfd614ea37caa2ad28'), 'CardSubwayTime': {'list_total_count': 608, 'RESULT': {'CODE': 'INFO-000', 'MESSAGE': '정상 처리되었습니다'}, 'row': [{'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '서울역', 'FOUR_RIDE_NUM': 654.0, 'FOUR_ALIGHT_NUM': 17.0, 'FIVE_RIDE_NUM': 9008.0, 'FIVE_ALIGHT_NUM': 6400.0, 'SIX_RIDE_NUM': 12474.0, 'SIX_ALIGHT_NUM': 37203.0, 'SEVEN_RIDE_NUM': 37253.0, 'SEVEN_ALIGHT_NUM': 91875.0, 'EIGHT_RIDE_NUM': 59876.0, 'EIGHT_ALIGHT_NUM': 187805.0, 'NINE_RIDE_NUM': 44619.0, 'NINE_ALIGHT_NUM': 118679.0, 'TEN_RIDE_NUM': 42611.0, 'TEN_ALIGHT_NUM': 57710.0, 'ELEVEN_RIDE_NUM': 49533.0, 'ELEVEN_ALIGHT_NUM': 50003.0, 'TWELVE_RIDE_NUM': 59357.0, 'TWELVE_ALIGHT_NUM': 53317.0, 'THIRTEEN_RIDE_NUM': 61171.0, 'THIRTEEN_ALIGHT_NUM': 53687.0, 'FOURTEEN_RIDE_NUM': 53310.0, 'FOURTEEN_ALIGHT_NUM': 49094.0, 'FIFTEEN_RIDE_NUM': 65767.0, 'FIFTEEN_ALIGHT_NUM': 52788.0, 'SIXTEEN_RIDE_NUM': 76249.0, 'SIXTEEN_ALIGHT_NUM': 53969.0, 'SEVENTEEN_RIDE_NUM': 122928.0, 'SEVENTEEN_ALIGHT_NUM': 64693.0, 'EIGHTEEN_RIDE_NUM': 184907.0, 'EIGHTEEN_ALIGHT_NUM': 73978.0, 'NINETEEN_RIDE_NUM': 87575.0, 'NINETEEN_ALIGHT_NUM': 46769.0, 'TWENTY_RIDE_NUM': 59961.0, 'TWENTY_ALIGHT_NUM': 30743.0, 'TWENTY_ONE_RIDE_NUM': 65078.0, 'TWENTY_ONE_ALIGHT_NUM': 27435.0, 'TWENTY_TWO_RIDE_NUM': 44921.0, 'TWENTY_TWO_ALIGHT_NUM': 22829.0, 'TWENTY_THREE_RIDE_NUM': 11581.0, 'TWENTY_THREE_ALIGHT_NUM': 8024.0, 'MIDNIGHT_RIDE_NUM': 30.0, 'MIDNIGHT_ALIGHT_NUM': 637.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 1.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '동묘앞', 'FOUR_RIDE_NUM': 51.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 3218.0, 'FIVE_ALIGHT_NUM': 1100.0, 'SIX_RIDE_NUM': 3422.0, 'SIX_ALIGHT_NUM': 4802.0, 'SEVEN_RIDE_NUM': 5896.0, 'SEVEN_ALIGHT_NUM': 9703.0, 'EIGHT_RIDE_NUM': 9194.0, 'EIGHT_ALIGHT_NUM': 24921.0, 'NINE_RIDE_NUM': 8022.0, 'NINE_ALIGHT_NUM': 17333.0, 'TEN_RIDE_NUM': 9687.0, 'TEN_ALIGHT_NUM': 19292.0, 'ELEVEN_RIDE_NUM': 14091.0, 'ELEVEN_ALIGHT_NUM': 24305.0, 'TWELVE_RIDE_NUM': 20089.0, 'TWELVE_ALIGHT_NUM': 26186.0, 'THIRTEEN_RIDE_NUM': 24776.0, 'THIRTEEN_ALIGHT_NUM': 28141.0, 'FOURTEEN_RIDE_NUM': 27144.0, 'FOURTEEN_ALIGHT_NUM': 26643.0, 'FIFTEEN_RIDE_NUM': 28360.0, 'FIFTEEN_ALIGHT_NUM': 23213.0, 'SIXTEEN_RIDE_NUM': 31119.0, 'SIXTEEN_ALIGHT_NUM': 17744.0, 'SEVENTEEN_RIDE_NUM': 27036.0, 'SEVENTEEN_ALIGHT_NUM': 13759.0, 'EIGHTEEN_RIDE_NUM': 23606.0, 'EIGHTEEN_ALIGHT_NUM': 10098.0, 'NINETEEN_RIDE_NUM': 11006.0, 'NINETEEN_ALIGHT_NUM': 6510.0, 'TWENTY_RIDE_NUM': 6119.0, 'TWENTY_ALIGHT_NUM': 4409.0, 'TWENTY_ONE_RIDE_NUM': 5485.0, 'TWENTY_ONE_ALIGHT_NUM': 4265.0, 'TWENTY_TWO_RIDE_NUM': 3405.0, 'TWENTY_TWO_ALIGHT_NUM': 5689.0, 'TWENTY_THREE_RIDE_NUM': 1035.0, 'TWENTY_THREE_ALIGHT_NUM': 2589.0, 'MIDNIGHT_RIDE_NUM': 4.0, 'MIDNIGHT_ALIGHT_NUM': 1348.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '시청', 'FOUR_RIDE_NUM': 37.0, 'FOUR_ALIGHT_NUM': 0.0, 'FIVE_RIDE_NUM': 1881.0, 'FIVE_ALIGHT_NUM': 4340.0, 'SIX_RIDE_NUM': 2948.0, 'SIX_ALIGHT_NUM': 21443.0, 'SEVEN_RIDE_NUM': 6280.0, 'SEVEN_ALIGHT_NUM': 62346.0, 'EIGHT_RIDE_NUM': 7740.0, 'EIGHT_ALIGHT_NUM': 167991.0, 'NINE_RIDE_NUM': 8117.0, 'NINE_ALIGHT_NUM': 72853.0, 'TEN_RIDE_NUM': 9284.0, 'TEN_ALIGHT_NUM': 29250.0, 'ELEVEN_RIDE_NUM': 14030.0, 'ELEVEN_ALIGHT_NUM': 27989.0, 'TWELVE_RIDE_NUM': 15295.0, 'TWELVE_ALIGHT_NUM': 25037.0, 'THIRTEEN_RIDE_NUM': 18849.0, 'THIRTEEN_ALIGHT_NUM': 24492.0, 'FOURTEEN_RIDE_NUM': 23331.0, 'FOURTEEN_ALIGHT_NUM': 20032.0, 'FIFTEEN_RIDE_NUM': 30469.0, 'FIFTEEN_ALIGHT_NUM': 17869.0, 'SIXTEEN_RIDE_NUM': 36116.0, 'SIXTEEN_ALIGHT_NUM': 15593.0, 'SEVENTEEN_RIDE_NUM': 66595.0, 'SEVENTEEN_ALIGHT_NUM': 16611.0, 'EIGHTEEN_RIDE_NUM': 135842.0, 'EIGHTEEN_ALIGHT_NUM': 17805.0, 'NINETEEN_RIDE_NUM': 46850.0, 'NINETEEN_ALIGHT_NUM': 8139.0, 'TWENTY_RIDE_NUM': 38173.0, 'TWENTY_ALIGHT_NUM': 4455.0, 'TWENTY_ONE_RIDE_NUM': 39048.0, 'TWENTY_ONE_ALIGHT_NUM': 4234.0, 'TWENTY_TWO_RIDE_NUM': 28501.0, 'TWENTY_TWO_ALIGHT_NUM': 3686.0, 'TWENTY_THREE_RIDE_NUM': 4390.0, 'TWENTY_THREE_ALIGHT_NUM': 1485.0, 'MIDNIGHT_RIDE_NUM': 3.0, 'MIDNIGHT_ALIGHT_NUM': 92.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종각', 'FOUR_RIDE_NUM': 127.0, 'FOUR_ALIGHT_NUM': 1.0, 'FIVE_RIDE_NUM': 2314.0, 'FIVE_ALIGHT_NUM': 4354.0, 'SIX_RIDE_NUM': 2868.0, 'SIX_ALIGHT_NUM': 23755.0, 'SEVEN_RIDE_NUM': 5479.0, 'SEVEN_ALIGHT_NUM': 96712.0, 'EIGHT_RIDE_NUM': 8419.0, 'EIGHT_ALIGHT_NUM': 223459.0, 'NINE_RIDE_NUM': 10625.0, 'NINE_ALIGHT_NUM': 131420.0, 'TEN_RIDE_NUM': 14727.0, 'TEN_ALIGHT_NUM': 50878.0, 'ELEVEN_RIDE_NUM': 23057.0, 'ELEVEN_ALIGHT_NUM': 44506.0, 'TWELVE_RIDE_NUM': 27707.0, 'TWELVE_ALIGHT_NUM': 39830.0, 'THIRTEEN_RIDE_NUM': 34538.0, 'THIRTEEN_ALIGHT_NUM': 40864.0, 'FOURTEEN_RIDE_NUM': 40378.0, 'FOURTEEN_ALIGHT_NUM': 33173.0, 'FIFTEEN_RIDE_NUM': 49745.0, 'FIFTEEN_ALIGHT_NUM': 29610.0, 'SIXTEEN_RIDE_NUM': 58664.0, 'SIXTEEN_ALIGHT_NUM': 29692.0, 'SEVENTEEN_RIDE_NUM': 114985.0, 'SEVENTEEN_ALIGHT_NUM': 33365.0, 'EIGHTEEN_RIDE_NUM': 192552.0, 'EIGHTEEN_ALIGHT_NUM': 39621.0, 'NINETEEN_RIDE_NUM': 78735.0, 'NINETEEN_ALIGHT_NUM': 19163.0, 'TWENTY_RIDE_NUM': 64989.0, 'TWENTY_ALIGHT_NUM': 7386.0, 'TWENTY_ONE_RIDE_NUM': 81179.0, 'TWENTY_ONE_ALIGHT_NUM': 4790.0, 'TWENTY_TWO_RIDE_NUM': 63653.0, 'TWENTY_TWO_ALIGHT_NUM': 3763.0, 'TWENTY_THREE_RIDE_NUM': 8153.0, 'TWENTY_THREE_ALIGHT_NUM': 1675.0, 'MIDNIGHT_RIDE_NUM': 21.0, 'MIDNIGHT_ALIGHT_NUM': 135.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}, {'USE_MON': '202106', 'LINE_NUM': '1호선', 'SUB_STA_NM': '종로3가', 'FOUR_RIDE_NUM': 191.0, 'FOUR_ALIGHT_NUM': 24.0, 'FIVE_RIDE_NUM': 3227.0, 'FIVE_ALIGHT_NUM': 3388.0, 'SIX_RIDE_NUM': 3069.0, 'SIX_ALIGHT_NUM': 13080.0, 'SEVEN_RIDE_NUM': 5108.0, 'SEVEN_ALIGHT_NUM': 25462.0, 'EIGHT_RIDE_NUM': 7412.0, 'EIGHT_ALIGHT_NUM': 70639.0, 'NINE_RIDE_NUM': 11673.0, 'NINE_ALIGHT_NUM': 73336.0, 'TEN_RIDE_NUM': 18502.0, 'TEN_ALIGHT_NUM': 57312.0, 'ELEVEN_RIDE_NUM': 29882.0, 'ELEVEN_ALIGHT_NUM': 55725.0, 'TWELVE_RIDE_NUM': 37009.0, 'TWELVE_ALIGHT_NUM': 53678.0, 'THIRTEEN_RIDE_NUM': 44050.0, 'THIRTEEN_ALIGHT_NUM': 51189.0, 'FOURTEEN_RIDE_NUM': 47626.0, 'FOURTEEN_ALIGHT_NUM': 46621.0, 'FIFTEEN_RIDE_NUM': 53071.0, 'FIFTEEN_ALIGHT_NUM': 40250.0, 'SIXTEEN_RIDE_NUM': 56955.0, 'SIXTEEN_ALIGHT_NUM': 34679.0, 'SEVENTEEN_RIDE_NUM': 68711.0, 'SEVENTEEN_ALIGHT_NUM': 31234.0, 'EIGHTEEN_RIDE_NUM': 94683.0, 'EIGHTEEN_ALIGHT_NUM': 33315.0, 'NINETEEN_RIDE_NUM': 55993.0, 'NINETEEN_ALIGHT_NUM': 16571.0, 'TWENTY_RIDE_NUM': 41534.0, 'TWENTY_ALIGHT_NUM': 6332.0, 'TWENTY_ONE_RIDE_NUM': 51588.0, 'TWENTY_ONE_ALIGHT_NUM': 4938.0, 'TWENTY_TWO_RIDE_NUM': 47756.0, 'TWENTY_TWO_ALIGHT_NUM': 4591.0, 'TWENTY_THREE_RIDE_NUM': 6768.0, 'TWENTY_THREE_ALIGHT_NUM': 2318.0, 'MIDNIGHT_RIDE_NUM': 25.0, 'MIDNIGHT_ALIGHT_NUM': 413.0, 'ONE_RIDE_NUM': 0.0, 'ONE_ALIGHT_NUM': 0.0, 'TWO_RIDE_NUM': 0.0, 'TWO_ALIGHT_NUM': 0.0, 'THREE_RIDE_NUM': 0.0, 'THREE_ALIGHT_NUM': 0.0, 'WORK_DT': '20210703'}]}}
문제 9: 공공데이터포털 서울시 구별 교통사고 사망자 수¶
import os
from src import mylib
keyPath=os.path.join(os.getcwd(), 'src', 'key.properties')
key=mylib.getKey(keyPath)
import os
SERVICE='AccidentDeath'
OPERATION_NAME='getRestTrafficAccidentDeath'
#params1=os.path.join(SERVICE,OPERATION_NAME)
params1="/".join([SERVICE,OPERATION_NAME])
print (params1)
AccidentDeath/getRestTrafficAccidentDeath
import urllib
_d=dict()
_d['searchYear']='2020'
_d['siDo']='1100' #서울특별시
_d['guGun']='1116'
_d['numOfRows']='20'
_d['pageNo']='1'
#params2=urllib.urlencode(_d)
#params2=urllib.parse.urlencode(_d).encode("utf-8")
params2=urllib.parse.urlencode(_d)
print (params2)
searchYear=2020&siDo=1100&guGun=1116&numOfRows=20&pageNo=1
params=params1+'?'+'serviceKey='+key['gokr']+'&'+params2
#print params|
import urllib
_url='http://apis.data.go.kr/B552061/'
url=urllib.parse.urljoin(_url,params)
print (url)
http://apis.data.go.kr/B552061/AccidentDeath/getRestTrafficAccidentDeath?serviceKey=5aRT%2Fpyk40PbDisBEqd6aYnrQ%2F9QUiCsRteDOzXaacgZ2e%2BuW4ROwo2o07N5wpdQppVtlJ%2FTV79t%2BLIwkp9I0A%3D%3D&searchYear=2020&siDo=1100&guGun=1116&numOfRows=20&pageNo=1
import requests
data=requests.get(url).text
print(data)
<response> <header> <resultCode>00</resultCode> <resultMsg>NORMAL_CODE</resultMsg> </header> <body> <items> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020010105</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>4</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>12</acc_ty_mlsfc_cd> <acc_ty_cd>02</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>959928 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1943154 </occrrnc_lc_y_crd> <lo_crd>127.04672718</lo_crd> <la_crd>37.48676083</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020011004</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>6</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>11</acc_ty_mlsfc_cd> <acc_ty_cd>01</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>03</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>964658 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1943332 </occrrnc_lc_y_crd> <lo_crd>127.10031827</lo_crd> <la_crd>37.48847939</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020011711</occrrnc_dt> <dght_cd>1</dght_cd> <occrrnc_day_cd>6</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>2</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>1</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>11</acc_ty_mlsfc_cd> <acc_ty_cd>01</acc_ty_cd> <aslt_vtr_cd>03 </aslt_vtr_cd> <road_frm_lclas_cd>02</road_frm_lclas_cd> <road_frm_cd>07</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>961578 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1945139 </occrrnc_lc_y_crd> <lo_crd>127.06521512</lo_crd> <la_crd>37.50480795</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020021120</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>3</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>21</acc_ty_mlsfc_cd> <acc_ty_cd>21</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>02</road_frm_lclas_cd> <road_frm_cd>06</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>05</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>958317 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947708 </occrrnc_lc_y_crd> <lo_crd>127.02845745</lo_crd> <la_crd>37.52752443</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020021500</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>7</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>2</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>1</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>11</acc_ty_mlsfc_cd> <acc_ty_cd>01</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>960501 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947375 </occrrnc_lc_y_crd> <lo_crd>127.05270573</lo_crd> <la_crd>37.52479842</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020032815</occrrnc_dt> <dght_cd>1</dght_cd> <occrrnc_day_cd>7</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>24</acc_ty_mlsfc_cd> <acc_ty_cd>25</acc_ty_cd> <aslt_vtr_cd>03 </aslt_vtr_cd> <road_frm_lclas_cd>02</road_frm_lclas_cd> <road_frm_cd>06</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>01</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>959690 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1945762 </occrrnc_lc_y_crd> <lo_crd>127.04389218</lo_crd> <la_crd>37.51025737</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020040420</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>7</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>24</acc_ty_mlsfc_cd> <acc_ty_cd>25</acc_ty_cd> <aslt_vtr_cd>99 </aslt_vtr_cd> <road_frm_lclas_cd>05</road_frm_lclas_cd> <road_frm_cd>98</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>05</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>960129 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947002 </occrrnc_lc_y_crd> <lo_crd>127.04873239</lo_crd> <la_crd>37.52158529</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020042622</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>1</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>03</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>35</acc_ty_mlsfc_cd> <acc_ty_cd>37</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>##</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>958652 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1946973 </occrrnc_lc_y_crd> <lo_crd>127.03187031</lo_crd> <la_crd>37.52090403</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020042905</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>4</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>3</injpsn_cnt> <se_dnv_cnt>1</se_dnv_cnt> <sl_dnv_cnt>1</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>22</acc_ty_mlsfc_cd> <acc_ty_cd>22</acc_ty_cd> <aslt_vtr_cd>03 </aslt_vtr_cd> <road_frm_lclas_cd>02</road_frm_lclas_cd> <road_frm_cd>06</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>01</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>957714 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1945882 </occrrnc_lc_y_crd> <lo_crd>127.02147347</lo_crd> <la_crd>37.51120884</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020050923</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>7</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>13</acc_ty_mlsfc_cd> <acc_ty_cd>03</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>960380 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947550 </occrrnc_lc_y_crd> <lo_crd>127.05163019</lo_crd> <la_crd>37.52637982</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020051814</occrrnc_dt> <dght_cd>1</dght_cd> <occrrnc_day_cd>2</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>22</acc_ty_mlsfc_cd> <acc_ty_cd>22</acc_ty_cd> <aslt_vtr_cd>04 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>01</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>965158 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1942078 </occrrnc_lc_y_crd> <lo_crd>127.10595422</lo_crd> <la_crd>37.47718981</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020052723</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>4</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>03</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>35</acc_ty_mlsfc_cd> <acc_ty_cd>37</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>##</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>960679 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947507 </occrrnc_lc_y_crd> <lo_crd>127.05472561</lo_crd> <la_crd>37.52559834</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020083118</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>2</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>2</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>1</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>24</acc_ty_mlsfc_cd> <acc_ty_cd>25</acc_ty_cd> <aslt_vtr_cd>04 </aslt_vtr_cd> <road_frm_lclas_cd>05</road_frm_lclas_cd> <road_frm_cd>98</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>05</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>01</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>964449 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1943651 </occrrnc_lc_y_crd> <lo_crd>127.09776295</lo_crd> <la_crd>37.49143349</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020100802</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>5</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>02</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>23</acc_ty_mlsfc_cd> <acc_ty_cd>23</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>03</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>03</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>957512 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1947551 </occrrnc_lc_y_crd> <lo_crd>127.01914343</lo_crd> <la_crd>37.52624030</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020102523</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>1</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>15</acc_ty_mlsfc_cd> <acc_ty_cd>05</acc_ty_cd> <aslt_vtr_cd>07 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>03</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>964600 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1943793 </occrrnc_lc_y_crd> <lo_crd>127.09946791</lo_crd> <la_crd>37.49266334</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020110623</occrrnc_dt> <dght_cd>2</dght_cd> <occrrnc_day_cd>6</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>11</acc_ty_mlsfc_cd> <acc_ty_cd>01</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>01</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>959516 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1942841 </occrrnc_lc_y_crd> <lo_crd>127.04218391</lo_crd> <la_crd>37.48371023</la_crd> </item> <item> <acc_year>2020</acc_year> <occrrnc_dt>2020111613</occrrnc_dt> <dght_cd>1</dght_cd> <occrrnc_day_cd>2</occrrnc_day_cd> <dth_dnv_cnt>1</dth_dnv_cnt> <injpsn_cnt>1</injpsn_cnt> <se_dnv_cnt>0</se_dnv_cnt> <sl_dnv_cnt>0</sl_dnv_cnt> <wnd_dnv_cnt>0</wnd_dnv_cnt> <occrrnc_lc_sido_cd>1100</occrrnc_lc_sido_cd> <occrrnc_lc_sgg_cd>1116</occrrnc_lc_sgg_cd> <acc_ty_lclas_cd>01</acc_ty_lclas_cd> <acc_ty_mlsfc_cd>12</acc_ty_mlsfc_cd> <acc_ty_cd>02</acc_ty_cd> <aslt_vtr_cd>05 </aslt_vtr_cd> <road_frm_lclas_cd>01</road_frm_lclas_cd> <road_frm_cd>05</road_frm_cd> <wrngdo_isrty_vhcty_lclas_cd>10</wrngdo_isrty_vhcty_lclas_cd> <dmge_isrty_vhcty_lclas_cd>12</dmge_isrty_vhcty_lclas_cd> <occrrnc_lc_x_crd>960743 </occrrnc_lc_x_crd> <occrrnc_lc_y_crd>1941805 </occrrnc_lc_y_crd> <lo_crd>127.05601771</lo_crd> <la_crd>37.47463673</la_crd> </item> </items> <totalCount>17</totalCount> <numOfRows>17</numOfRows> <pageNo>1</pageNo> </body> </response>
'Data Science > 데이터분석 (Spark)' 카테고리의 다른 글
[빅데이터분석] Spark RDD 다루기 : 구조 생성, 데이터 처리 및 Map-Reduce (0) | 2023.11.27 |
---|---|
[빅데이터분석] Apache Spark가 각광받고 있는 이유에 대한 백엔드 개발자의 관찰 (1) | 2023.11.27 |
[Pandas] 데이터 분석을 위한 판다스 사용법 - 6. 데이터 편집 (0) | 2023.07.06 |
[Pandas] 데이터 분석을 위한 판다스 사용법 - 5. 데이터 분석 (0) | 2023.07.06 |
[Pandas] 데이터 분석을 위한 판다스 사용법 - 4. 데이터 가공 : 자료구조와 원소 변경하기 (0) | 2023.07.05 |