<jupyter_start><jupyter_text>numpy arrays examples<jupyter_code>import numpy as np<jupyter_output><empty_output><jupyter_text>Create N dimensional arrays: By literal - note that the number of opening squares equals the dimension<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a<jupyter_output><empty_output><jupyter_text>Create array filled with random values: __np.empty__ of type __np.int8__<jupyter_code>b = np.empty( (3,2), dtype=np.int8  )
b<jupyter_output><empty_output><jupyter_text>Create array by __np.arange()__ method (quite simmilar to python's __range()__)<jupyter_code>b = np.arange(0,21,2)
b<jupyter_output><empty_output><jupyter_text>Simple indexing<jupyter_code>a[1][2]<jupyter_output><empty_output><jupyter_text>Basic numpy properties and methods The number of axes (dimensions) of the array: __a.ndim__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.ndim<jupyter_output><empty_output><jupyter_text>Tuple of integers indicating the size of the array in each dimension: __ndarray.shape__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.shape
b = np.array([[1,2],[3,4],[5,6]])
b.shape<jupyter_output><empty_output><jupyter_text>Total number of elements of the array: __a.size__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.size<jupyter_output><empty_output><jupyter_text>The size in bytes of each element of the array: __a.itemsize__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.itemsize<jupyter_output><empty_output><jupyter_text>Array Manipulations  Flatten the array<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.ravel()<jupyter_output><empty_output><jupyter_text>reshaping arrays: __np.reshape()__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
a.shape
a.reshape(3,2)
a.reshape(1,6)<jupyter_output><empty_output><jupyter_text>Arrays Algebra (Element Wise)<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
b = np.array([[1,2,3],[4,5,6]])

a+b<jupyter_output><empty_output><jupyter_text>matrix product: __dot()__<jupyter_code>a = np.array([[1,2,3],[4,5,6]])
b = np.array([[1,2],[3,4],[5,6]])

a.dot(b)
b.dot(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17818889970788704, 'fraction_numerical': 0.04186952288218111, 'mean_word_length': 10.291208791208792, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '550769', 'license': 'MIT', 'n_tokens_mistral': 905, 'n_tokens_neox': 890, 'n_words': 127, 'path': 'pages/themes/beginners/dataScienceBasics/examples/numpy/NDArrays.ipynb', 'repo_name': 'ProgressBG-Python-Course/ProgressBG-VC-Python', 'size': '2054'}