<jupyter_start><jupyter_text><jupyter_code>import pandas as pd 
import numpy as np 

url='https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/04_Apply/Students_Alcohol_Consumption/student-mat.csv'
df=pd.read_csv(url)
df.head()
school=df.loc[:,"school":"guardian"]
school.head()
#capatilize the all the string
capitalizer=lambda x: x.capitalize()
school['Fjob'].apply(capitalizer)
school['Mjob'].apply(capitalizer)
school.tail()
school['Fjob']=school['Fjob'].apply(capitalizer)
school['Mjob']=school['Mjob'].apply(capitalizer)
school.tail()
def legal_drinker(x):
  if x > 17:
    return True
  else:
    return False 

school["legal_drinker"]=school['age'].apply(legal_drinker)
school.head()
def multiply(x):
  if type(x) is int:
    return 10 * x
  return x
school.applymap(multiply).head(5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15632458233890215, 'fraction_numerical': 0.008353221957040573, 'mean_word_length': 6.9904761904761905, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, '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': '649376', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 326, 'n_tokens_neox': 305, 'n_words': 51, 'path': 'pandas_exercise3.ipynb', 'repo_name': 'AmitNaikRepository/pandas_exercises', 'size': '838'}