본문 바로가기

Data Analysis/Kaggle

[Kaggle] Zomato Bangalore Restaurants 데이터 분석 3 (EDA / 시각화 / 리뷰)

728x90

이전 내용은 아래 글에서 확인 하실 수 있습니다.

[Data Analysis/Kaggle] - [Kaggle] Zomato Bangalore Restaurants 데이터 분석 (데이터 확인 / 질문하기)

 

[Kaggle] Zomato Bangalore Restaurants 데이터 분석 (데이터 확인 / 질문하기)

Zomato Bangalore Restaurants 데이터 분석 데이터 출처 :  https://www.kaggle.com/himanshupoddar/zomato-bangalore-restaurants Zomato Bangalore Restaurants Restaurants of Bengaluru www.kaggle.com 1..

sks8410.tistory.com

[Data Analysis/Kaggle] - [Kaggle] Zomato Bangalore Restaurants 데이터 분석 (데이터 전처리)

 

[Kaggle] Zomato Bangalore Restaurants 데이터 분석 (데이터 전처리)

이전 내용은 아래 글에서 확인 하실 수 있습니다. [Data Analysis/Kaggle] - [Kaggle] Zomato Bangalore Restaurants 데이터 분석 (데이터 확인 / 질문하기) [Kaggle] Zomato Bangalore Restaurants 데이터 분석 (..

sks8410.tistory.com

4. EDA & Visualization

4-1 방갈로르에 가장 많은 레스토랑은?

# 가장 많은 레스토랑 top10 확인

zomato_name_top10 = zomato["name"].value_counts().head(10)

zomato_name_top10

 

 

# 가장 많은 레스토랑 top10 시각화

fig = px.bar(zomato_name_top10, y = zomato_name_top10.index, x = zomato_name_top10.values,
             orientation = "h", color = zomato_name_top10.index)

fig.update_layout(
    showlegend = False,
    title = dict(
        text = "<b>방갈로르에 가장 많은 레스토랑 Top10</b>",
        font_size = 20
    ),
    
    xaxis = dict(
        title = "레스토랑 수"
    ),
    
    yaxis = dict(
        title = "레스토랑 이름"
    ),
    
    template = "plotly_white"

)

fig.show()

Onesta 레스토랑 수가 방갈로르에 가장 많습니다.

4-2 방갈로르의 레스토랑 운영 형태는?

# 레스토랑 운영 형태 top10확인

zomato_rest_type_top10 = zomato["rest_type"].value_counts().head(10)

zomato_rest_type_top10

 

 

# 가장 많은 레스토랑 운영 형태 top10 시각화

fig = px.bar(zomato_rest_type_top10, y = zomato_rest_type_top10.index, x = zomato_rest_type_top10.values,
             orientation = "h", color = zomato_rest_type_top10.index)

fig.update_layout(
    showlegend = False,
    title = dict(
        text = "<b>방갈로르 레스토랑 운영 형태 Top10</b>",
        font_size = 20
    ),
    
    xaxis = dict(
        title = "레스토랑 수"
    ),
    
    yaxis = dict(
        title = "레스토랑 운영형태"
    ),
    
    template = "plotly_white"

)

fig.show()

방갈로르에는 Casual Dining 형태의 레스토랑이 가장 많이 운영되고 있습니다.

4-3 방갈로르의 어느 위치에 레스토랑이 가장 많은가?

# 레스토랑 위치별 레스토랑 수 확인

zomato_city = zomato["list_city"].value_counts()

zomato_city

 

 

# 방갈로르 위치별 레스토랑 수 시각화

fig = px.bar(zomato_city, y = zomato_city.index, x = zomato_city.values,
             orientation = "h", color = zomato_city.index)

fig.update_layout(
    height = 1000,
    showlegend = False,
    title = dict(
        text = "<b>방갈로르 위치별 레스토랑 수</b>",
        font_size = 20
    ),
    
    xaxis = dict(
        title = "레스토랑 수"
    ),
    
    yaxis = dict(
        title = "지역명"
    ),
    
    template = "plotly_white"

)

fig.show()

BTM 지역에 레스토랑이 가장 많이 있습니다.

4-4 온라인 주문과 테이블 예약이 가능한 식당 비율은?

# 온라인 주문이 가능한 식당 수 확인

zomato_online = zomato["online_order"].value_counts()

zomato_online

 

 

# 테이블 예약이 가능한 식당 수 확인

zomato_book_table = zomato["book_table"].value_counts()

zomato_book_table

 

 

# 온라인 주문 / 테이블 예약 가능 레스토랑 수 시각화

fig = make_subplots(rows = 1, cols = 2)

fig.add_trace(
    go.Bar(x = zomato_online.index,
           y = zomato_online.values,          
           marker_color = px.colors.qualitative.Plotly),
    row = 1, col = 1
)

fig.add_trace(
    go.Bar(x = zomato_book_table.index,
           y = zomato_book_table.values,           
           marker_color = px.colors.qualitative.Vivid),
    row = 1, col = 2
)

fig.update_xaxes(title = "온라인 주문", dtick = 1, row = 1, col = 1, ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "레스토랑 수", row = 1, col = 1)

fig.update_xaxes(title = "테이블 예약", dtick = 1, row = 1, col = 2, ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "레스토랑 수", row = 1, col = 2)

fig.update_layout(
    showlegend = False,
    title = dict(
        text = "<b>온라인 주문 / 테이블 예약 가능 레스토랑 수</b>",
        font_size = 20
    ),
    
    template = "plotly_white"
)


fig.show()

온라인 주문이 가능한 레스토랑이 불가능한 레스토랑보다 2배 이상 많고, 테이블 예약이 불가능한 레스토랑이 가능한 레스토랑보다 2배 이상 많습니다.

4-5 온라인 주문 / 테이블 예약이 금액과 평점에 영향을 주는가?

# 온라인 주문 / 테이블 예약과 금액과의 관계 시각화

fig = make_subplots(rows = 1, cols = 2)

fig.add_trace(
    go.Box(x = zomato["online_order"], y = zomato["cost"]),
    row = 1, col = 1
)

fig.add_trace(
    go.Box(x = zomato["book_table"], y = zomato["cost"]),
    row = 1, col = 2
)

fig.update_xaxes(title = "온라인 주문", row = 1, col = 1, ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "평균 식사 금액(2인 기준)", row = 1, col = 1, range = [0, 3000])

fig.update_xaxes(title = "테이블 예약", row = 1, col = 2,  ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "평균 식사 금액(2인 기준)", row = 1, col = 2, range = [0, 3000])

fig.update_layout(
    showlegend = False,
    title = dict(
        text = "<b>온라인 주문 / 테이블 예약과 금액과의 상관관계</b>",
        font_size = 20
    ),
    template = "plotly_white"
)

fig.show()

온라인 주문이 가능한 레스토랑이 불가능한 레스토랑보다 평균 식사 금액이 낮고, 테이블 예약이 가능한 레스토랑이 불가능한 레스토랑보다 평균 식사 금액이 높습니다.

 

 

# 온라인 주문 / 테이블 예약과 평점과의 관계 시각화

fig = make_subplots(rows = 1, cols = 2)

fig.add_trace(
    go.Box(x = zomato["online_order"], y = zomato["rating"]),
    row = 1, col = 1
)

fig.add_trace(
    go.Box(x = zomato["book_table"], y = zomato["rating"]),
    row = 1, col = 2
)

fig.update_xaxes(title = "온라인 주문", row = 1, col = 1, ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "평점", row = 1, col = 1)

fig.update_xaxes(title = "테이블 예약", row = 1, col = 2,  ticktext = ["No", "Yes"], tickvals = [0, 1])
fig.update_yaxes(title = "평점", row = 1, col = 2)

fig.update_layout(
    showlegend = False,
    title = dict(
        text = "<b>온라인 주문 / 테이블 예약과 평점과의 상관관계</b>",
        font_size = 20
    ),
    template = "plotly_white"
)

fig.show()

온라인 주문이 불가능한 경우가 가능한 경우보다 평점이 조금 높지만 크게 차이가 나지 않습니다.

테이블 예약이 가능한 경우가 불가능한 경우보다 평점이 높게 나타납니다.

4-6 레스토랑의 종류별로 메뉴가 다를까?

# 워드 클라우드 패키지 불러오기

from wordcloud import WordCloud, STOPWORDS 

# 상위 3개 레스토랑 타입 지정

zomato_re = zomato.copy()
rest = zomato_re['rest_type'].value_counts()[:3].index 

# 레스토랑 타입별로 워드클라우드 그리는 함수

def zomato_wordcloud(rest):
    plt.figure(figsize = (20,20))
    for i, rest_tp in enumerate(rest):
        plt.subplot(1,3,i+1)
        dishes = ''
        data = zomato_re[zomato_re['rest_type'] == rest_tp]
        
        #dish_liked에 있는 단어들을 쪼개준다
  
        for word in data['dish_liked']:
            words = word.split()
            dishes = dishes + " ".join(words) + " "
        
        wordcloud = WordCloud(background_color = 'white', colormap = 'seismic', collocations = False, stopwords = stopwords, width=1200, height=1200).generate(dishes)
        
        plt.imshow(wordcloud)
        plt.title(rest_tp)
        plt.axis("off")
       
stopwords = set(STOPWORDS) 
zomato_wordcloud(rest)

Casual Dining 타입의 레스토랑의 경우 Chicken, Biryani 메뉴가 눈에 띄게 많은 것을 알 수 있습니다.

Quick Bites 타입의 레스토랑의 경우 Chicken 메뉴가 조금 많지만 다양한 메뉴를 골고루 제공하고 있다는 것을 알 수 있습니다.

Cafe 타입의 레스토랑의 경우 Pizza, Burger, Chicken, Pasta 위주의 메뉴를 제공한다는 것을 할 수 있습니다.

5. Review

1) 방갈로르에 가장 많은 레스토랑은?
   - Onesta 레스토랑이 가장 많습니다.

2) 방갈로르의 레스토랑 운영 형태는?   
   - Casual Dining 이 가장 많이 운영되고 있습니다.

3) 방갈로르의 어느 위치에 레스토랑이 가장 많은가?
 - BTM 지역에 레스토랑이 가장 많습니다.

4) 온라인 주문과 테이블 예약이 가능한 식당 비율은? 
 - 온라인 주문 가능한 레스토랑이 주문이 안되는 레스토랑 보다 2배 이상 많고, 테이블 예약이 안되는 레스토랑이 되는 레스토랑 보다 2배 이상 많습니다.

5) 온라인 주문/테이블 예약이 금액과 평점에 영향을 주는가?  
 - 온라인 주문이 가능한 레스토랑이 불가능한 레스토랑보다 가격이 낮은 편이고, 테이블 예약이 가능한 레스토랑이 불가능한 레스토랑보다 가격이 높은 편입니다.

   - 온라인 주문이 불가능 시 평점이 조금 높지만 주문 가능여부에 따른 평점 차이가 크지 않고,  테이블 예약이 가능한 레스토랑이 불가능한 레스토랑에 비해 평점이 좀 더 높은 편이다.

6) 레스토랑의 종류별 메뉴 확인

   - Casual Dining 타입의 레스토랑의 경우 Chicken, Biryani 메뉴가 위주로 제공하고 있습니다.

   - Quick Bites 타입의 레스토랑의 경우 Chicken 메뉴가 조금 많지만 다양한 메뉴를 골고루 제공하고 있습니다.

   - Cafe 타입의 레스토랑의 경우 Pizza, Burger, Chicken, Pasta 위주의 메뉴를 제공하고 있습니다.

728x90