본문 바로가기

Data Analysis/기타 데이터

[기타 데이터] Airbnb NewYork 데이터 분석 1 (데이터 확인 / 질문)

728x90

Airbnb NewYork 데이터 분석

분석 목적 : 2021년 9월 1일자 에어비앤비 뉴욕 데이터

데이터 출처 : http://insideairbnb.com/get-the-data.html

 

Inside Airbnb. Adding data to the debate.

Inside Airbnb is a set of independent tools and open data that allows you to explore how Airbnb is being used in cities around the world.

insideairbnb.com

1. 데이터 확인

# 기본 패키지 불러오기

import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use("seaborn") 
sns.set(font_scale = 1)
sns.set_style("whitegrid")

import plotly.express as px

import chart_studio.plotly as py
import cufflinks as cf
cf.go_offline(connected=True)

import plotly.graph_objects as go
import plotly.offline as pyo
pyo.init_notebook_mode()

from plotly.subplots import make_subplots

import missingno as msno

import warnings # 경고 메세지 숨기기
warnings.filterwarnings(action='ignore')

plt.rc("font", family = "AppleGothic") # 한글 폰트 가져오기
plt.rcParams['axes.unicode_minus'] = False # - 기호 깨짐 해결

 

# 데이터 불러오기

bnb = pd.read_csv("data/airbnb_newyork_data.csv")

print(bnb.shape)
bnb.head()

 

<컬럼 설명>

- id: 일련번호
- name: AirBnB 이름
- host_id: 호스트 ID  
- host_name: 호스트 성명 
- neighbourhood_group: 지구명
- neighbourhood : 지역명
- latitude: 위도  
- longitude: 경도  
- room_type: 방 타입  
- price: 가격  
- minimum_nights: 최소 숙박일수  
- number_of_reviews: 리뷰 개수
- last_review: 최근 리뷰 일자
- reviews_per_month: 월 평균 리뷰 수
- calculated_host_listings_count:  호스트에게 대여 가능한 에어비앤비의 총 개수
- availability_365: 1년 중 가능한 대여일수

 

 

# 데이터 정보 확인

bnb.info()

 

 

# 수치형 데이터 통계치 확인

bnb.describe()

컬럼에 이상치로 생각되는 값이 있어서 전처리 시 확인 후 처리를 하도록 하겠습니다.

 

 

# 범주형 데이터 통계치 확인

bnb.describe(include = np.object_)

 

 

# 범주형 데이터 종류 확인

print("neighbourhood_group:", bnb["neighbourhood_group"].unique())
print("room_type:", bnb["room_type"].unique())

 

 

# 결측치 확인

bnb.isnull().sum()

 

 

# 결측치 시각화

msno.bar(bnb)

결측치는 대부분 리뷰 컬럼에 있으며, 전처리 시 필요에 따라 결측치 처리 방법을 결정하도록 하겠습니다.

 

 

# 데이터 내용 간단히 정리

print("총 데이터 개수: ", bnb.shape[0] * bnb.shape[1])
print("총 결측치 수: {} = 전체 데이터의 {:.2f}%".format(bnb.isnull().sum().sum(), (bnb.isnull().sum().sum()*100) / (bnb.shape[0] * bnb.shape[1])))
print("호스트 ID: {} 개, 호스트 {} 명".format(bnb["host_id"].nunique(), bnb["host_name"].nunique()))
print("2021년 9월 기준 뉴욕 Airbnb 평균 금액: {:.2f}$".format(bnb["price"].mean()))

2. 질문

- 뉴욕 에어비앤비 금액대 분포는?
- 가장 많이 에어비앤비에 리스트 된 호스트는?
- 지역별로 가장 비싼 방과 저렴한 방은?
- 뉴욕의 어느 지역이 가장 비쌀까?
- 지역별로 에어비앤비 타입이 다를까?
- 리뷰가 가장 많은 방은?

728x90