Python for Data Science
TS. Lương Văn Thiện
Business AI Lab, Khoa KHDL&TTNT, Trường CN, ĐH Kinh tế Quốc dân
thienlv@[Link]
1
Content
1. Introduction to Python
2. Python environment and setup
• Google Colab ([Link]
• Anaconda (Spider, Jupyter notebook)
3. Popular Python libraries for DS
4. Python programming for DS
2
Introduction to Python
3
Python libraries for DS
4
Python libraries for DS (more detailed)
• Data manipulation
• Data visualization
• Statistical analysis
• Time-series analysis
• Natural language processing
• Web scraping
• Database operation
• Machine learning
5
Install Anaconda
[Link]
(win, linux, mac)
6
Create a Python environment (Conda)
Open Anaconda prompt:
• conda create -n my_env
• conda activate my_env
• conda install my_package
• conda env list
• conda uninstall my_package
• pip install my_package
• conda upgrade my_package
• conda update my_package
• Open a program: Python, spider, jupyter
notebook (enter)
my_package can be numpy, pandas, …
my_env is the name of your environment
7
Open-source packages in Anaconda
8
Spyder IDE
9
Spyder notebook
conda install spyder-notebook 10
Jupyter notebook
11
Deep Learning frameworks
12
Google Colab (online coding)
[Link]
13
Python programming for DS
• Basic Python
• Numpy
• Pandas
• Matplotlib
• Advanced Python
14
Basic Python
• Operators
• Data types
• Control Flow
15
Basic Operators in Python
16
Arithmetic Operators
17
Data types
18
List operators
19
Set operators
20
Data type comparison in Python
21
If Else
22
For loop
23
While loop
24
Numpy package
• ndarray creation
• indexing, slicing
• broadcasting
• reshaping
• universal functions
• array-oriented programming
• where
• mathematical & statistical methods
• boolean methods
• sorting
• linear algebra
25
Pandas package
• ndarray creation
• indexing, slicing
• broadcasting
• reshaping
• universal functions
• array-oriented programming
• where
• mathematical & statistical methods
• boolean methods
• sorting
• linear algebra
26
Matplotlib package
• [Link]
• [Link]
• [Link]
• plt.set_title
• plt.set_ylabel
• [Link]
• [Link]()
27
Seaborn package
• sns.set_style
• [Link]()
• [Link]()
• [Link]()
• [Link]()
• [Link]()
28
Advanced Python
• Functions
• Class (OOP)
29
Functions
30
Object-Oriented Programming (OOP)
31