<jupyter_start><jupyter_text>NumPy Indexing and Selection<jupyter_code>import numpy as np
array = np.arange(0,11)
array
array[3]
array[3:8]
array[0:4] = 100
array
slice = array[1:5]
slice
slice[:]=44
slice
array
arr_copy = array.copy()
arr_copy
arr_copy[1:3]=25
arr_copy
array
arr_2d = np.array(([5,10,15],[20,25,30],[35,40,45]))

arr_2d
arr_2d[0]
arr_2d[0][1]
arr_2d[0,1]
arr_2d[:2,1:]
arr_2d[2]
arr_2d[2,:]
arr_2d < 30<jupyter_output><empty_output><jupyter_text>NumPy Operations<jupyter_code>arr = np.arange(0,10)
arr
arr + arr
arr * arr
arr - arr
arr / arr
1/arr
arr**3<jupyter_output><empty_output><jupyter_text>Universal Array Functions<jupyter_code>np.sqrt(arr)
arr*2
np.sqrt(arr**2)
np.exp(arr)
np.sin(arr)
np.log(arr)<jupyter_output>/home/nourpc/.local/lib/python3.6/site-packages/ipykernel_launcher.py:1: RuntimeWarning: divide by zero encountered in log
  """Entry point for launching an IPython kernel.<jupyter_text>Summary Statistics on Arrays<jupyter_code>arr = np.arange(0,10)
arr
arr.sum()
arr.mean()
arr.max()
arr.var()
arr.std()
arr_2d = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])
arr_2d
arr_2d.sum()
arr_2d.sum(axis=0)<jupyter_output><empty_output><jupyter_text>By passing in axis=0, we're returning an array of sums along the vertical axis, essentially [(1+5+9), (2+6+10), (3+7+11), (4+8+12)]<jupyter_code>arr_2d.shape
arr_2d.sum(axis=1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17219020172910662, 'fraction_numerical': 0.07780979827089338, 'mean_word_length': 7.8471337579617835, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 20, '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': '178592', 'license': 'MIT', 'n_tokens_mistral': 674, 'n_tokens_neox': 634, 'n_words': 106, 'path': 'NumPy/01-NumPy-Indexing-and-Selection & NumPy Operations.ipynb', 'repo_name': 'mohamednourdine/PyTorch', 'size': '1388'}