Versions Compared

Key

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

...

No Format
expesiveHotel = hotellist_sc.filter( lambda row : row['discount'] > 300000 )
#전체를 다 가져오거나?
expesiveHotel.collect()
#특정 개수만 획득
expesiveHotel.take(5)


==> 데이터 예
[{'addrSummary': '강남 | 삼성역 도보 1분',
  'availableRooms': 5,
  'displayText': '서울 > 파크 하얏트 서울',
  'distance': 0.0,
  'districtName': '강남구',


중복제거-

...

호텔 관리데이터 확인

No Format
grades = hotellist_sc.map( lambda row: row['grade'] ).distinct()
grades.take(1005)


==> 결과 : 해당 데이터가 관리하는 grade파악이 가능합니다.
['special1',
 'special2',
 'grade2',
 'motel',
 'design',
 'biz',
 'grade1',
 'residence',
 'boutique',
 'grade3',
 'guest_house]


regions = hotellist_sc.map( lambda row: row['districtName'] ).distinct()
regions.take(5)
==> 결과
['중구', '강남구', '서초구', '강서구', '구로구']

사용자 알고리즘 적용

사전준비: 사용할 알고리즘 준비하기

...

No Format
#서울의 어느 호텔 'latitude': 37.5700718, 'longitude': 127.0089115
nearHotel= hotellist_sc.filter( lambda row : 5 > getDistance(37.5700718,127.0089115,row['latitude'],row['longitude'] ) )
nearHotel.take(10)
nearHotel.count()


비슷한 이름 호텔찾기

No Format
siHotel = hotellist_sc.filter( lambda row : 2 > edit_distance('호텔 리안 A',row['name'] ) )
siHotel.take(100)

...