<jupyter_start><jupyter_text><jupyter_code>import numpy as np
list1 = [1,2,3,4]
arr1 = np.array(list1)
print (arr1)
print (type(arr1))
arr_prod = arr1 + 2
print (arr_prod)
list2 = [[1,2,3],[4,5,6],[7,8,9]]
arr2 = np.array(list2)
print (arr2)
arr3 = np.array(list2,dtype=float)
arr3
arr3.astype('bool')
arr4 = np.array([1,0,10],dtype=bool)
arr4
arr5  = np.array([1,'Manoj'],dtype=object)
arr5
arr5.tolist()
arr6 = np.arange(1,11)
arr6
arr2.ndim
arr2.shape
arr2.dtype
arr2.size
arr2
arr2[1,0]
ar = arr2 > 5
ar
arr2[ar]
arr2[::-1,::-1]
arr2.astype('int')
arr2.max()
arr2.min()
arr2.mean()
np.amin(arr2,axis=1)
np.amax(arr2,axis=1)
np.cumsum(arr2)
arr7 = arr2[1:,1:]
arr7
arr7[1:,1:]=9
arr7
arr2
arr7 = arr2[1:,1:].copy()
arr7
arr7[1:,1:]=0
arr7
arr2
arr2
arr8 = np.append(arr2,arr7,axis=1)
arr8
arr8.shape
arr9 = np.delete(arr8,12,axis=0)
arr9.reshape(6,2)
arr9.ravel()
np.zeros([5,5])
np.ones([5,5])
np.repeat(arr9,2)
np.random.rand(2,2)
np.random.randint(1,10,size=[2,2])
np.random.randn(1,10)
arr10 = np.arange(0,10)
get_index= np.where(arr10>5)
arr10.take(get_index)
np.where(arr10>5,'Y','N')
np.max(arr10)
np.min(arr10)
arr10
arr9
np.delete(arr9,11,axis=0)
arr9
a= np.zeros([5,5])
b = np.ones([5,5])
np.concatenate([a,b],axis = 0)
np.vstack([a,b])
np.concatenate([a,b],axis=1)
np.hstack([a,b])
arr11 = np.random.randint(1,10,size=[8,4])
arr11
np.sort(arr11,axis=1)
arr12 = np.array([1,10,5,2,8,9])
sort_index = np.argsort(arr12)
sort_index
arr12[sort_index]
arr11[0,:].argsort()
arr11
arr11[sort_index[::-1]]
import numpy as np
arr15 = np.arange(1,11)
print (arr15)
arr15.ndim
arr15.astype('float')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22208588957055214, 'fraction_numerical': 0.1196319018404908, 'mean_word_length': 6.766666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '42069', 'license': 'MIT', 'n_tokens_mistral': 892, 'n_tokens_neox': 858, 'n_words': 127, 'path': 'Numpy_Practice.ipynb', 'repo_name': 'manojgupta3051994/dsmp-pre-work', 'size': '1630'}