<jupyter_start><jupyter_text>Data VisualizationRefer to Data Visualization Folder  Transform variables to construct feature  Convert Summary and House_rules into length<jupyter_code>df_final['summary_len'] = df_final['summary'].str.split().str.len()
df_final['houserules_len'] = df_final['house_rules'].str.split().str.len()
df_final["host_response_time"].unique()
df_final['a few hours'] = (df_final['host_response_time'] == 'within a few hours')
df_final['a day'] = (df_final['host_response_time'] == 'within a day')
df_final['an hour'] = (df_final['host_response_time'] == 'within an hour')
df_final['a few days or more'] = (df_final['host_response_time'] == 'a few days or more')

df_final[['a few hours','a day','an hour','a few days or more']] = df_final[['a few hours','a day','an hour','a few days or more']].astype(int)
df_final['Manhattan'] = (df_final['neighbourhood_group_cleansed'] == 'Manhattan')
df_final['Brooklyn'] = (df_final['neighbourhood_group_cleansed'] == 'Brooklyn')
df_final['Queens'] = (df_final['neighbourhood_group_cleansed'] == 'Queens')
df_final['Bronx'] = (df_final['neighbourhood_group_cleansed'] == 'Bronx')
df_final['Staten_Island'] = (df_final['neighbourhood_group_cleansed'] == 'Staten Island')

df_final[['Manhattan','Brooklyn','Queens','Bronx','Staten_Island']] = df_final[['Manhattan','Brooklyn','Queens','Bronx','Staten_Island']].astype(int)
df_final['Others'] = df_final['Bronx'] + df_final['Staten_Island']
df_final['Entire home'] = (df_final['room_type'] == 'Entire home/apt')
df_final['Private_room'] = (df_final['room_type'] == 'Private room')
df_final['Shared_room'] = (df_final['room_type'] == 'Shared room')

df_final[['Entire home','Private_room','Shared_room']] = df_final[['Entire home','Private_room','Shared_room']].astype(int)
df_final['flexible'] = (df_final['cancellation_policy'] == 'flexible')
df_final['moderate'] = (df_final['cancellation_policy'] == 'moderate')
df_final['strict_14'] = (df_final['cancellation_policy'] == 'strict_14_with_grace_period')
df_final['strict_30'] = (df_final['cancellation_policy'] == 'super_strict_30')
df_final['strict'] = (df_final['cancellation_policy'] == 'strict')

df_final[['flexible','moderate','strict_14','strict_30','strict']] = df_final[['flexible','moderate','strict_14','strict_30','strict']].astype(int)
df_final.head()
df_done = df_final.drop(columns = ['summary','house_rules','host_response_time','Bronx','CheckDup','Staten_Island','strict','neighbourhood_group_cleansed','room_type','cancellation_policy'])
df_done.head()
df_done.dtypes
df_done['price']=df_done['price'].str.replace('$','')
df_done['price']=df_done['price'].str.replace(',','')
df_done['price'] = df_done['price'].astype(float)
df_done['price'].head()
df_done['host_response_rate']=df_done['host_response_rate'].str.replace('%','')
df_done['host_response_rate'] = df_done['host_response_rate'].astype(float)
df_done['host_response_rate'] = df_done['host_response_rate']/100
df_done['host_response_rate'].head()
df_done['security_deposit']=df_done['security_deposit'].str.replace('$','')
df_done['security_deposit']=df_done['security_deposit'].str.replace(',','')
df_done['security_deposit'].head()
df_done['cleaning_fee']=df_done['cleaning_fee'].str.replace('$','')
df_done['cleaning_fee']=df_done['cleaning_fee'].str.replace(',','')
df_done['cleaning_fee'].head()
df_done['extra_people']=df_done['extra_people'].str.replace('$','')
df_done['extra_people']=df_done['extra_people'].str.replace(',','')
df_done['extra_people'].head()
df_done.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21086711711711711, 'fraction_numerical': 0.005349099099099099, 'mean_word_length': 13.212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '48363', 'license': 'MIT', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1278, 'n_words': 152, 'path': 'Data Preprocessing/Data preprocessing.ipynb', 'repo_name': 'HailinDu/Airbnb-Price-Prediction', 'size': '3552'}