Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
title호텔정보 200개

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']

기본 사용

리스트를 Spark

...

데이터 프레임으로 변환

No Format
hotellist_sc = sc.parallelize(hotels)


다시 Spark

...

데이터 프레임을 리스트 데이터로 반환

No Format
hotellist_sc.collect()

...

Panel
df = pd.read_json( json.dumps(hotellist_sc.collect() ) )
df
Image Removed
addrSummaryavailableRoomscategorydiscountgradehotelIdxlatitudelongitudenameregionNamereviewCount
07hotel169900special123430.130.1메이필드호텔서울223


여기서 의미 있는 값이 무엇인지? 필드명을 파악합니다.