<jupyter_start><jupyter_text>Indixing<jupyter_code>arr = np.array([1,2,3,4,5,6])
arr
arr[3]
lst1 = [1,2,3,4,5]
lst2 = [6,7,8,9,10]
lst3 = [11,12,13,14,15]

arr = np.array([lst1,lst2,lst3])
arr
arr[1:,3:]
arr[:,:]
arr[0:,0:]
arr[0:2,0:2]
arr[1:,3:]
arr[1:,2:4]
arr[1,1:4]
arr = np.arange(0,10)
arr
arr = np.arange(0,10,step=2)
arr
np.linspace(1,10,50)

## copy function and broadcasting
arr = np.array([1,2,3,4,5,6,7,8,9])
arr
arr[5:] = 49
arr
arr1 = arr
arr1[5:]=194
arr1
arr
arr2 = arr1.copy()
arr2
arr2[5:] = 97
arr2
print(arr)
print(arr1)
print(arr2)
## some conditions very useful in explotary data analysis
val = 3
arr<4
arr*val
arr%2
arr[arr<3]
arr[arr<300]
np.arange(1,21).reshape(2,10)
arr1 = np.arange(0,10).reshape(2,5)
arr1
arr2 = np.arange(0,10).reshape(2,5)
arr2
arr1*arr2
np.ones(5)
np.ones(3,dtype=int)
np.ones((3,4),dtype=int)
## Random distrubution
np.random.rand(4,4)
arr_ex = np.random.randn(3,5)
arr_ex
import seaborn as sns
import pandas as pd
sns.distplot(pd.DataFrame(arr_ex.reshape(15,1)))
np.random.randint(0,100,12).reshape(3,4)
np.random.random_sample((2,5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21255605381165918, 'fraction_numerical': 0.12645739910313902, 'mean_word_length': 6.804195804195804, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, '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': '502768', 'license': 'Apache-2.0', 'n_tokens_mistral': 615, 'n_tokens_neox': 583, 'n_words': 94, 'path': 'Prerequisite/Numpy.ipynb', 'repo_name': 'up1512001/Machine-Learning', 'size': '1115'}