사용준비
import pyspark import requests import pandas as pd import json sc = pyspark.SparkContext('local[*]')
샘플데이터
크롤을 하던지, List를 이용하던지 둘중에 하나를 선택
hotellist2 = sc.parallelize(hotels)
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
Version 1 Next »
import pyspark import requests import pandas as pd import json sc = pyspark.SparkContext('local[*]')
크롤을 하던지, List를 이용하던지 둘중에 하나를 선택
import requests
import json
chkein = '2018-01-18'
stays = 1
url = 'http://mobile.dailyhotel.co.kr/api/v3/hotels/sales?dateCheckIn={}&stays={}&provinceIdx=5&areaIdx=&page=1&limit=200&persons=2&details=true'.format(chkein,stays)
r = requests.get(url)
data = r.json()
hotels=data['data']['hotelSales']
hotellist2 = sc.parallelize(hotels)