{"cells":[{"metadata":{},"cell_type":"markdown","source":"Numpy is a python Library"},{"metadata":{},"cell_type":"markdown","source":"It's used almost in every field of science and engineering."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"#Importing Numpy\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#To create a NumPy array, you can use the function np.array().\na = np.array([1,2,3,4,5,6])\na","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print (a[0])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"a = np.array([[1,2,3,4,5,6], [5,6,7,8,9,10], [1,2,3,4,5,6]])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print([a[0]])","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":""},{"metadata":{"trusted":true},"cell_type":"code","source":"In NumPy, dimensions are called axes. This means that if you have a 2D array that looks like this:","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"[[0., 0., 0.],\n [1., 1., 1.]]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# Create an empty array with 2 el\nnp.empty(2)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":""},{"metadata":{},"cell_type":"markdown","source":""},{"metadata":{"trusted":true},"cell_type":"code","source":"#You can create an array with a range of elements:","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"np.arange(4)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":""},{"metadata":{},"cell_type":"markdown","source":""},{"metadata":{"trusted":true},"cell_type":"code","source":"#You can also use np.linspace() to create an array with values that are spaced linearly in a specified interval:","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"np.linspace(0, 10, num=5)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#Recommended Convention to import numpy is\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Creating Array**"},{"metadata":{"trusted":true},"cell_type":"code","source":"a = np.array([1,2,3,4])\na","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"a.ndim","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"a.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"len(a)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# **Creating 2D And 3D Array**"},{"metadata":{"trusted":true},"cell_type":"code","source":"b = np.array([[1,2,3], [4,5,6]])\nb","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"b.ndim","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"b.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"len(b)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"c = np.array([[[1],[2]],[[3],[4]]])\nc","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"c.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}