# Python Numpy

## What is it ?

`NumPy’s main object is the homogeneous multidimensional array. It is a table of elements (usually numbers), all of the same type, indexed by a tuple of non-negative integers. In NumPy dimensions are called axes.`

## From lists to Numpy Arrays

`list = [1,2,3,4,5,6]print(list)>>>[1, 2, 3, 4, 5, 6]`
`import numpy as npnp_array = np.array([1, 2, 3, 4, 5, 6])print(np_array)>>>[1 2 3 4 5 6]Do note the lack of commas which tell us we are dealing with something different than a regular list. `

## Type and type conversion

`You can find all the types and more information here:Numpy data Types`

## Dimensions and Shape

`grocery_list = np.array(['eggs', 'milk', 'cereal', 'bacon'])print("Dimensions:", grocery_list.ndim)>>> Dimensions: 1print("Shape:", grocery_list.shape)Dimensions: 1>>> Shape: (4,)`
`chartData = X,Y = np.array([[1, 2, 3, 4],[2, 4, 6, 8]])Dimensions: 2Shape: (2, 4) length: 2 =  2 dimensions, first axe has 2 elements [1,2,3,4,] and [2,4,6,8], the second axe has 4 elements, also note we are assigning X and Y values upon creation which is a common way to pass values to a chart...print(X):>>> [1 2 3 4]print(Y):>>> [2 4 6 8]`
`point_in_space = X,Y,Z = np.array([[],[],[]])Dimensions: 3Shape: (3, 1, 1)`
`point_in_spaceWithComment = X, Y, Z, comment = np.array([                            [[]],                            [[]],                            [[]],                            [[['My Favorite Point']]]                            ])Dimensions: 4Shape: (4, 1, 1, 1)`
`points_in_spaceWithComments = np.array([                                         [2, 4, 2, 'Comment1'],                                         [4, 6, 8, 'Comment2'],                                         [1, 4, 3, 'Comment3']                                         ])Dimensions: 2Shape: (3, 4)`

Written by