<jupyter_start><jupyter_text>Examples Example 1: MOAR Looping!Let say a class has the following grades where all students failed. The teacher decides to double the grade of each student to pass some. Here is how you would have done it using builtin arrys and loops.You can it do the same using numpy without looping over data yourself. Here is how you can do it with numpy.<jupyter_code>import numpy as np

grades = [20,10,30,40,10,20,12,14,15,16,14,12,16]

#old and busted
new_grades = []
for grade in grades:
    new_grades.append(grade*2)
print(new_grades)

#new hotness
grades = np.array(grades)
new_grades = grades*2
print(new_grades)<jupyter_output><empty_output><jupyter_text>Example 2: Descriptive Statistics Finding min,max,avg and other such numerical information of grades becomes a lot easier.<jupyter_code>min_grade = grades.min()
max_grade = grades.max()
avg_grade = grades.sum()/len(grades)

print("Min grade: ",min_grade)
print("Max grade: ",max_grade)
print("Avg grade: ",avg_grade)<jupyter_output><empty_output><jupyter_text>Example 3: Selecting And Filtering ValuesLet's select all students having grades less than 25 and let's find max gradeof students meeting the above condition.<jupyter_code>grades[grades<25]
grades[grades<25].max()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09175738724727839, 'fraction_numerical': 0.028771384136858476, 'mean_word_length': 6.615384615384615, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '418519', 'license': 'MIT', 'n_tokens_mistral': 430, 'n_tokens_neox': 401, 'n_words': 139, 'path': '03 Advanced/21-numpy.ipynb', 'repo_name': 'MassStreetUniversity/tutorial-python', 'size': '1286'}