Data Wrangling
Week 7
Dr. Ferdin Joe John Joseph
Faculty of Information Technology
Thai – Nichi Institute of Technology, Bangkok
Today’s Lesson
• Introduction to Numpy
• Numpy - Theories
• Numpy usage in Python
• Demonstration
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
2
Numpy
• Python library for scientific computing
• Install in command prompt
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
3
Usage of Numpy
• Managing n dimensional arrays
• Mathematical functions like fourier transform, linear algebra and random
number generator
• Backbone of data science in python
• Pandas is built on top of this
• Created in 2005 by Travis Oliphant
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
4
Import numpy
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
5
np notation
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
6
Numpy version
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
7
Type of numpy array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
8
0 Dimensional array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
9
1 Dimensional array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
10
2 Dimensional Array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
11
3 Dimensional Array
• Otherwise known as Tensor
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
12
3 dimensional array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
13
Find dimension of array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
14
Dimension of array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
15
Get first element of array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
16
Get second element of array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
17
Add two elements in array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
18
Access elements in 2 dimensional array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
19
Access elements in 3 dimensional array
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
20
Negative indexing
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
21
Array Slicing
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
22
Slicing from beginning
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
23
Negative Slicing
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
24
Jump two indices
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
25
Slicing 2 dimensional arrays
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
26
Activity
• Using numpy perform matrix multiplication of two dimensional arrays
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
27
Activity
• Using numpy create pascal’s triangle
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
28
Revision- Pre Mid Term
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
29
Next Week
Faculty of Information Technology, Thai - Nichi Institute of
Technology, Bangkok
https://github.com/ferdinjoe/DSA201
30

Data Wrangling Week 7

  • 1.
    Data Wrangling Week 7 Dr.Ferdin Joe John Joseph Faculty of Information Technology Thai – Nichi Institute of Technology, Bangkok
  • 2.
    Today’s Lesson • Introductionto Numpy • Numpy - Theories • Numpy usage in Python • Demonstration Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 2
  • 3.
    Numpy • Python libraryfor scientific computing • Install in command prompt Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 3
  • 4.
    Usage of Numpy •Managing n dimensional arrays • Mathematical functions like fourier transform, linear algebra and random number generator • Backbone of data science in python • Pandas is built on top of this • Created in 2005 by Travis Oliphant Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 4
  • 5.
    Import numpy Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 5
  • 6.
    np notation Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 6
  • 7.
    Numpy version Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 7
  • 8.
    Type of numpyarray Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 8
  • 9.
    0 Dimensional array Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 9
  • 10.
    1 Dimensional array Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 10
  • 11.
    2 Dimensional Array Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 11
  • 12.
    3 Dimensional Array •Otherwise known as Tensor Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 12
  • 13.
    3 dimensional array Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 13
  • 14.
    Find dimension ofarray Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 14
  • 15.
    Dimension of array Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 15
  • 16.
    Get first elementof array Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 16
  • 17.
    Get second elementof array Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 17
  • 18.
    Add two elementsin array Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 18
  • 19.
    Access elements in2 dimensional array Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 19
  • 20.
    Access elements in3 dimensional array Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 20
  • 21.
    Negative indexing Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 21
  • 22.
    Array Slicing Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 22
  • 23.
    Slicing from beginning Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 23
  • 24.
    Negative Slicing Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok 24
  • 25.
    Jump two indices Facultyof Information Technology, Thai - Nichi Institute of Technology, Bangkok 25
  • 26.
    Slicing 2 dimensionalarrays Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 26
  • 27.
    Activity • Using numpyperform matrix multiplication of two dimensional arrays Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 27
  • 28.
    Activity • Using numpycreate pascal’s triangle Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 28
  • 29.
    Revision- Pre MidTerm Faculty of Information Technology, Thai - Nichi Institute of Technology, Bangkok 29
  • 30.
    Next Week Faculty ofInformation Technology, Thai - Nichi Institute of Technology, Bangkok https://github.com/ferdinjoe/DSA201 30