Libraries Flashcards
What is NUMPY used for?
Used for large, multi-dimensional arrays and matrices, along with a wide range of mathematical functions to operate on these arrays. Arrays are like lists but implemented in C using contiguous blocks of memory so work much faster.
Numpy Arrays also use much less memory as Python Lists stores pointers to objects.
Numpy allows for Vectorised operations like myArray * 2 which multiples every element by 2
NumPy arrays are homogeneous - Must all be same datatypes
Python lists are Hetrogenous - Supports different datatypes
Numpy arrays comes in 2 types, Vectors and Matrices
Vectors are 1D arrays whilst Matrices are usually 2D.
What is PANDAS?
Pandas allows you to process data in tabular format by using data tables called DataFrame for multi dimension ‘tables’ and Series for single dimension . Pandas can convert from and to many different types of data (XL, CSV, json, sql, …).
For example, if we have the following dictionary showing 2 keys with a List:
data = {“Country”: [“Portugal”, “USA”, “France”],
“Population”: [1000,2000,3000]}
We can convert this into table format using df = pd.DataFrame(data)
Country Population
0 Portugal 1000
1 USA 2000
2 France 3000
FASTAPI
TODO