<jupyter_start><jupyter_text>Let's try to get the earnings in the year for multi and single hosts. For that, we need to convert the prices to numeric, first.<jupyter_code>def prices_to_num(price_str):
    """ Converts a price like $67.0 to a float (67.0)"""
    if price_str is np.nan:
        return np.nan
    return float(price_str[1:].replace(',',''))
listings.price = listings.price.apply(prices_to_num)
num_listings = listings.select_dtypes(include=['int', 'float'])
num_listings.shape<jupyter_output><empty_output><jupyter_text>Any other field contains the $ character?<jupyter_code>obj_listings = listings.select_dtypes(include='object')
obj_listings.shape
listings.shape
obj_listings.head()<jupyter_output><empty_output><jupyter_text>There seem to be some "t" / "f" values that should be converted to boolean. There are also dates as strings. Some of the other strings are categorical, and some are just text.<jupyter_code>def find_dsigns(df):
    return df.apply(lambda x: x.str.contains('\$'), axis=1)
    
has_dsign = find_dsigns(obj_listings)
all_dsign = obj_listings[obj_listings.columns[has_dsign.all()]]
all_dsign.head()<jupyter_output><empty_output><jupyter_text>So, we found all the prices and fees!<jupyter_code>any_dsign = obj_listings[obj_listings.columns[has_dsign.any()]]
any_dsign = any_dsign.drop(all_dsign.columns, axis=1)
any_dsign.head()<jupyter_output><empty_output><jupyter_text>Those seem to have some random \$ signs, but they are probably not important. Let's check the fraction of those that have the \$ sign.<jupyter_code>dsigns = find_dsigns(any_dsign)
dsigns.mean()<jupyter_output><empty_output><jupyter_text>Mostly irrelevant. Maybe "transit" has something interesting.<jupyter_code>any_dsign.transit[dsigns.transit.fillna(False)].head(20)<jupyter_output><empty_output><jupyter_text>Oh, it's very reasonable: some of the "transit" texts state the price of transportation. Nothing else to do there.<jupyter_code>calendar.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11384152457372117, 'fraction_numerical': 0.005516549648946841, 'mean_word_length': 7.044354838709677, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '529244', 'license': 'MIT', 'n_tokens_mistral': 707, 'n_tokens_neox': 690, 'n_words': 160, 'path': 'notebooks/scratchpad/s01-questions1.ipynb', 'repo_name': 'mtasende/airbnb-analysis', 'size': '1994'}