text_plain_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

data = pd.read_csv('../input/airbnbnewyork/listings.csv')

data.shape

data.isnull().sum()

data.drop(['id', 'host_name', 'last_review'], axis=1, inplace=True)

data.fillna({'reviews_per_month': 0}, inplace=True)
data.reviews_per_month.isnull().sum()

data.neighbourhood_group.unique()

len(data.neighbourhood.unique())

data.room_type.unique()

#we will skip first column for now and begin from host_id

#let's see what hosts (IDs) have the most listings on Airbnb platform and taking advantage of this service
top_host=data.host_id.value_counts().head(10)
top_host

top_host_check = data.calculated_host_listings_count.max()
top_host_check

sub_1 = data.loc[data['neighbourhood_group'] == 'Brooklyn']
price_sub1 = sub_1[['price']]
sub_2 = data.loc[data['neighbourhood_group'] == 'Manhattan']
price_sub2 = sub_2[['price']]
sub_3 = data.loc[data['neighbourhood_group'] == 'Queens']
price_sub3 = sub_3[['price']]
sub_4 = data.loc[data['neighbourhood_group'] == 'Staten Island']
price_sub4 = sub_4[['price']]
sub_5 = data.loc[data['neighbourhood_group'] == 'Bronx']
price_sub5 = sub_5[['price']]
price_list_by_n = [price_sub1, price_sub2, price_sub3, price_sub4, price_sub5]

p_l_b_n_2 = []
nei_list = ['Brooklyn', 'Manhattan', 'Queens', 'Staten Island', 'Bronx']
for x in price_list_by_n:
    i = x.describe(percentiles=[0.25, 0.5, 0.75])
    i = i.iloc[3:]
    i.reset_index(inplace=True)
    i.rename(columns={'index': 'Stats'}, inplace=True)
    p_l_b_n_2.append(i)
p_l_b_n_2[0].rename(columns={'price': nei_list[0]}, inplace=True)
p_l_b_n_2[1].rename(columns={'price': nei_list[1]}, inplace=True)
p_l_b_n_2[2].rename(columns={'price': nei_list[2]}, inplace=True)
p_l_b_n_2[3].rename(columns={'price': nei_list[3]}, inplace=True)
p_l_b_n_2[4].rename(columns={'price': nei_list[4]}, inplace=True)
stat_df = p_l_b_n_2
stat_df = [df.set_index('Stats') for df in stat_df]
stat_df = stat_df[0].join(stat_df[1:])
stat_df