Skip to content

Commit 17e362f

Browse files
authored
Merge pull request #1 from offhock/dev
Dev
2 parents 8318255 + 21a62a2 commit 17e362f

File tree

8 files changed

+3704
-0
lines changed

8 files changed

+3704
-0
lines changed

WEBdataAnalysis/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# 데이터 분석) 파이썬을 이용한 서울시 이디야, 스타벅스 매장 위치 분석
2+
3+
본 내용은 아래의 유투브를 보고 실습한 내용을 정리한 것이다.
4+
5+
> 유투브: https://youtu.be/qobe7k1CmGc
6+
>
7+
8+
9+
## 위도 경도
10+
11+
https://python.hotexamples.com/examples/geopy.geocoders/Nominatim/-/python-nominatim-class-examples.html
12+
13+
```python
14+
import requests
15+
import urllib
16+
17+
def get_nominatim_geocode(address):
18+
url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) + '?format=json'
19+
try:
20+
response = requests.get(url).json()
21+
return response[0]["lon"], response[0]["lat"]
22+
except Exception as e:
23+
# print(e)
24+
return None, None
25+
26+
for idx, rows in tqdm(df_coffee.iterrows()):
27+
#print(rows["주소"])
28+
tmp = get_nominatim_geocode(rows["주소"].split("(")[0])
29+
if tmp:
30+
lon = tmp[0]
31+
lat = tmp[1]
32+
df_coffee.loc[idx, "위도"] = lat
33+
df_coffee.loc[idx, "경도"] = lon
34+
else:
35+
print(idx, rows["주소"])
36+
37+
```

WEBdataAnalysis/coffee_map.csv

+1,311
Large diffs are not rendered by default.
11 MB
Binary file not shown.

0 commit comments

Comments
 (0)