<jupyter_start><jupyter_text>Suppose you want to clip Item_MRP to 200 and not consider any value greater than that.<jupyter_code>data['Item_MRP'][:5]
def clip_price(price):
    if price>200:
        price = 200
    return price
data['Item_MRP'].apply(lambda x : clip_price(x))[:5]
#before label encoding 
data['Outlet_Location_Type'][:5]
#label encode by city type 
def label_encode(city):
    if city == 'Tier 1':
        label = 0
    elif city == 'Tier 2':
        label = 1
    else:
        label = 3 
    return label
data['Outlet_Location_Type'].apply(lambda x : label_encode(x))[:5]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12258064516129032, 'fraction_numerical': 0.02903225806451613, 'mean_word_length': 3.8515625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '115120', 'license': 'MIT', 'n_tokens_mistral': 227, 'n_tokens_neox': 211, 'n_words': 58, 'path': '13 Apply function.ipynb', 'repo_name': 'delwarhub/Introduction-to-Python', 'size': '620'}