Welcome to Brannon's Reading Notes!

This serves as my personal page to keep and update my reading notes for Code Fellows Courses 201, 301, and 401.

Reading 11

NumPy

Numpy is a data analysis package in Python. This package can simplify calculations ina variety of calculations.

2D Arrays (Matrix)

Note: In numpy, rows are considered the first axis, columns are considered the second axis.

Now, let’s import and use numpy:

import numpy as np
wines = np.array(wines[1:], dtype=np.float)

Now when you display “wines” you get:

array([[ 7.4 , 0.7 , 0. , ..., 0.56 , 9.4 , 5. ],
[ 7.8 , 0.88 , 0. , ..., 0.68 , 9.8 , 5. ],
[ 7.8 , 0.76 , 0.04 , ..., 0.65 , 9.8 , 5. ],
...,
[ 6.3 , 0.51 , 0.13 , ..., 0.75 , 11. , 6. ],
[ 5.9 , 0.645, 0.12 , ..., 0.71 , 10.2 , 5. ],
[ 6. , 0.31 , 0.47 , ..., 0.66 , 11. , 6. ]])

You can return the number of rows and columns using shape

wines.shape

returns

(1599,12)

Other useful Array Methods:

source: https://www.dataquest.io/blog/numpy-tutorial-python/