Professional Documents
Culture Documents
Introduction To Numpy and Pandas: 24/11/2021 Fernando Cruz, Marta Sampaio, Nuno Alves
Introduction To Numpy and Pandas: 24/11/2021 Fernando Cruz, Marta Sampaio, Nuno Alves
pandas
24/11/2021
Fernando Cruz,
Marta Sampaio,
Nuno Alves
Outline
Matrices pandas
◦ What is a matrix? ◦ Series
◦ Matrices operations ◦ Dataframe
◦ Dataframe manipulation
NumPy
◦ Viewing data
◦ Arrays
◦ Indexing and selection
◦ Basic operations
◦ Missing data
◦ Indexing, slicing and iterating
◦ Column operations
◦ Manipulation
◦ Daframe merge
◦ IO
◦ Dataframe grouping
◦ Plotting
What is a matrix?
o Numeric structures organized into rows (n) and columns (m)
element
Type of matrices
Name Shape Example Description
Element-wise addition.
Matrices operations
Matrices additions and subtractions
Element-wise subtraction.
Multiplying two matrices can only be done if the number of columns (m) of
the first matrix is the same as the number of rows (n) of the second
Matrices operations
Multiplying by another matrix
(2 x 2) (2 x 2)
AxB=
(2 x 2)
x
Matrices operations
Multiplying by another matrix
4 x 3 + (-1) x 6 + 5 x (-2) 12 - 6 - 10 -4
AxB= = = 49
3 x 3 + 6 x 6 + (-2) x (-2) 9 + 36 + 4
Matrices operations
Matrices division
(This concept is not correct, as we must multiply the matrix for the inverse!)
A : B = A x B-1
Matrices operations
Transpose
The fundamental package for scientific The fundamental package for data analysis and
computing with Python manipulation in Python
Hands on
1. Load the datasets 1 and 2 using pandas.
5. Make a scatter plot for the first two columns of the resulting dataset from 4.