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

listings = pd.read_csv('/kaggle/input/airbnb-buenosaires/listings.csv')
calendar = pd.read_csv('/kaggle/input/airbnb-buenosaires/calendar.csv')

listings = listings.loc[:, ['id', 'host_is_superhost', 'host_identity_verified', 'neighbourhood_cleansed', 'room_type', 'price', 'minimum_nights', 'availability_365', 'number_of_reviews', 'instant_bookable', 'accommodates', 'bathrooms_text', 'beds', 'calculated_host_listings_count', 'reviews_per_month', 'price', 'minimum_nights', 'maximum_nights']]
airbnb = listings.merge(calendar, how='inner', left_on='id', right_on='listing_id').sample(frac=0.1)
airbnb.drop(columns=['price_x', 'minimum_nights_x', 'maximum_nights_x', 'listing_id', 'adjusted_price'], inplace=True)
airbnb.rename(columns={'price_y': 'price', 'minimum_nights_y': 'minimum_nights', 'maximum_nights_y': 'maximum_nights'}, inplace=True)

airbnb.fillna({'reviews_per_month': 0}, inplace=True)
airbnb['price'] = airbnb['price'].replace('[$,]', '', regex=True).astype(float)
airbnb = airbnb.loc[airbnb['price'] > 0]
airbnb.host_is_superhost.fillna('f', inplace=True)
airbnb['host_is_superhost'] = airbnb['host_is_superhost'].replace({'f': 0})
airbnb['host_is_superhost'] = airbnb['host_is_superhost'].replace({'t': 1})
airbnb.host_identity_verified.fillna('f', inplace=True)
airbnb['host_identity_verified'] = airbnb['host_identity_verified'].replace({'f': 0})
airbnb['host_identity_verified'] = airbnb['host_identity_verified'].replace({'t': 1})
airbnb['available'] = airbnb['available'].replace({'f': 0})
airbnb['available'] = airbnb['available'].replace({'t': 1})
airbnb['instant_bookable'] = airbnb['instant_bookable'].replace({'f': 0})
airbnb['instant_bookable'] = airbnb['instant_bookable'].replace({'t': 1})
print(airbnb.isna().sum())