<jupyter_start><jupyter_text>Funtions 1. Arguments (Inputs)2. Instructions (Operations)3. Output  Function 1: No Arguments<jupyter_code>def alert():
    print ("Stop Here!")
alert()<jupyter_output>Stop Here!<jupyter_text>Function 2: 1 Argument<jupyter_code>def square_number(number):
    result = number ** 2
    return (result)
square_number(8)
def square_number_2(number):
    return (number ** 2)
square_number_2(8)<jupyter_output><empty_output><jupyter_text>Function 3: Multiple Arguments<jupyter_code>def calculate_percent(numerator, demoninator):
    percent = (numerator/demoninator) * 100
    return (percent)
calculate_percent(80, 120)
def calculate_percent(numerator, demoninator):
    return ((numerator/demoninator) * 100)<jupyter_output><empty_output><jupyter_text>Function 4: Lambda<jupyter_code>f = lambda number: number*2
f(2)
percent = lambda x, y: x/y*100
percent(80, 120)<jupyter_output><empty_output><jupyter_text>Apply Functions on DataFrames<jupyter_code>import pandas as pd
# Initialize a dictionary
data = {'names': ['Tshepo', 'Jack', 'Thabang', 'Vincent', 'Kenny'],
        'Game Played': ['CoD 2019', 'Fortnite', 'PES', 'FIFA', 'CoD 2019'],
        'Hours Played': [2, 4, 1, 7, 10]}
df = pd.DataFrame(data)
df
def above_avg(hour):
    if hour > df['Hours Played'].mean():
        return ('Above Average')
    else:
        return ('Below Average')
        
df['Avg Player'] = df['Hours Played'].apply(above_avg)
df<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1414965986394558, 'fraction_numerical': 0.03333333333333333, 'mean_word_length': 5.778801843317972, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '91688', 'license': 'MIT', 'n_tokens_mistral': 569, 'n_tokens_neox': 520, 'n_words': 117, 'path': '4. Functions.ipynb', 'repo_name': 'TshepoMK/Data-Analysis---YT', 'size': '1470'}