The repository provides all the material for my YouTube course "Python For Data Science", which you find on YUNIKARN. The course introduces Python and its use in the context of data analysis, machine learning, and simulations.
This video explains how to install Python for applications in Data Science. Anaconda is usually the favourite installation as it offers Python and R as well as several integrated development environments (IDEs). We also discuss alternative IDEs and text editors such as Sublime Text.
Chapters
- 0:00 How to get started?
- 0:14 Anaconda
- 1:45 Updating
- 2:04 Python Installation
- 2:29 Python Shell
- 3:46 Text Editors
- 4:46 Review of Options
You might find the following links useful:
This video walks you through your first session in Python. We will use the Jupyter Notebook and the Spyder IDE. After installing Anaconda (see the first video of the playlist), you have access to Jupyter and Spyder. At the end of the video, we will discuss which IDE might be the best for work in Data Science. We cover assignments, the print and type function. We explain what "dynamically typed" means. At the end of the video, you will be able to start working in the Jupyter Notebook or Spyder.
Chapters
- 0:00 First Session in Python
- 0:24 Starting Jupyter Notebook
- 0:55 Instruct the Machine
- 1:12 Assignment
- 2:02 Print Function
- 2:32 Type Function
- 2:54 Dynamically Typed
- 3.23 Reassignment
- 5:11 First Error Message
- 6:02 Starting Spyder
- 7:36 Variable Explorer
- 8:26 Best IDE for Data Science?
Are you telling the truth? In this video, we introduce Booleans. I show you how to assert relationships and assign Booleans. We cover logic (and, or, not) and the bool function.
Chapters
- 0:00 Booleans
- 0:17 Assert Relationships
- 2:04 Assign Booleans
- 3:08 And, Or, Not
- 5:26 Bool Function
This video introduces lists. We start with an empty list and add items using the append method. The len function is discussed. Then we explore indexing, the pop method, and slicing. Finally, we briefly discuss shallow copies of lists and the reverse method.
Chapters
- 0:00 Lists in Python
- 0:39 Empty List
- 1:35 Append Method
- 3:10 Len Function
- 3:41 Indexing
- 5:38 Pop Method
- 6:34 Slicing
- 7:41 Shallow Copy
- 8:28 Reverse Method
- 9:39 In or Not In
This video introduces tuples and sets in Python. We start with empty tuples or sets and demonstrate the use of the plus operator (tuples) and the add method (set). The differences between tuples, sets and lists are made clear, exploring indexing, slicing, and the meaning of order. We see the unpacking of tuples in action, which is useful in many applications. Finally, we discuss the pros and cons of different "containers" for data in the context of data science.
Chapters
- 0:00 Tuples & Sets
- 0:20 Empty Tuple
- 0:48 Adding Items to Tuple
- 2:23 Indexing
- 3:05 Slicing
- 3:43 Mutability
- 4:07 Why use Tuples?
- 4:48 Unpacking
- 5:57 Empty Set
- 6:28 Adding Items to Set
- 7:37 In and Not In
- 8:11 No Order
- 8:40 Data Science Application
This video introduces dictionaries in Python. We explain how dictionaries can be used to store and extract values based on their keys. The update method permits adding new key-value pairs or updating values. The list function converts a dictionary into a list of its keys. Finally, we discuss the dict() constructor to build dictionaries from other data structures.
Chapters
- 0:00 Dictionaries
- 0:38 Key: Value Pairs
- 1:50 Extracting Values
- 2:33 Update Method
- 3:39 List Function
- 5:04 Dict() Constructor
This video introduces for and while loops in Python. We start with for loops using range. Then we loop over iterable objects such as lists. Finally, we use while loops to construct Fibonacci numbers. While you watch this video, be careful not to enter an infinite loop as you might never escape!
Chapters
- 0:00 Loops
- 0:27 For Loops Using Range
- 2:15 Iterable Objects
- 4:03 While Loop
- 8:59 Infinite loops
This video introduces if - elif - else statements in Python, which are used in branching statements. We start with if statements and check the behaviour of our code after adding additional if statements and an else statement. Finally, we play around with else-if (elif) statement. If you are not confused by the end of this video, you are a real Pythonian!
Chapters
- 0:00 Branching
- 0:23 If Statement
- 1:37 Else Statement
- 2:28 Combining If Statements
- 3:37 Elif Statement
Welcome to your first project in Python. Your coding challenge is to develop a Python code that takes the name of a customer using the terminal, adds food items to the order, and displays the total price to be paid. This is 20 minutes of fun using the input function, for loops over lists, a while loop, and list comprehension.
Chapters
- 0:00 The Takeaway Challenge
- 0:27 Problem Statement
- 2:05 Storing Data
- 3:37 Input Function
- 5:05 Building Lists
- 5:34 For Loop over List
- 7:22 Branching
- 13:00 While Loop
- 16:54 List Comprehension
This video introduces functions in Python. We start by defining a function. Then we explore the scope of variables and demonstrate how to call functions. Arguments are introduced. Functions might return an object. The coding challenge includes exception handling and fun with while loops.
Chapters
- 0:00 Introduction to Functions
- 0:53 Defining Functions
- 1:31 Calling Functions
- 1:57 Scope
- 2:25 Arguments
- 4:27 Return
- 5:23 Coding Challenge
- 7:38 Exception Handling
- 11:24 Build Small
- 17:21 Return Tuple
This video introduces Object-Oriented Programming (OOP) in Python. We explain the basic principles by building a staff management system. Our first class is the Staff class. Attributes are introduced to store information on instances of a class. Magic methods (or Dunder methods “Double Under Underscores”) are used to initialize an instance and to modify string representations. Finally, I show you how to use modules to organise your code in a more efficient manner. Many Data Scientists do not know much about OOP, which is a mistake in my view.
Chapters
- 0:00 Introduction to OOP
- 0:21 Design Staff Management System
- 1:02 Your First Class
- 2:09 Attributes
- 2:35 Magic Methods
- 4:39 Modules
- 7:46 Methods
- 10:39 The repr Method
This video introduces NumPy, which is an essential package in Python used for scientific computing. If you want to get into Data Science, NumPy is impossible to ignore. It offers efficient data structures: NumPy arrays, which we discuss in detail. Vectorization is a process to replace loops with array operations, which makes your code a lot faster. This video also covers NumPy functions, matrix multiplication, merging data, and the ravel vs flatten debate.
Chapters
- 0:00 Introduction to NumPy
- 0:56 NumPy Functions
- 1:49 NumPy Array
- 5:56 Matrix Multiplication
- 9:12 Descriptive Statistics
- 9:42 The arange and linspace Functions
- 10:48 Merging Data
- 12:24 The ravel vs flatten Debate
This video explores random number generation in NumPy (random). We develop a Python code to implement a betting strategy used in Roulette. Betting focuses on 50:50 bets (not quite 50:50 as the casino wins at 0). You double your bet after every loss and reduce your bet to the initial bet after every win. In theory, you should be able to recover losses. These strategies are called the Martingale strategy (or reverse martingale strategy). Can these strategies work? How much money do you need to survive the downside risk (tail risk)? In this process, we also have our first exposure to visualisation using Matplotlib.pyplot. Let's start the game!
Chapters
- 0:00 NumPy Random
- 1:02 Python Code for Betting
- 1:48 Random Numbers
- 2:32 Branching
- 3:49 While Loop
- 6:27 Visualisation
- 6:54 Betting Function
- 7:39 IndexError
This video introduces Pandas, which we will use quite extensively in this course. We learn how to import data from csv files and how to work with Pandas DataFrames. We select Pandas series, convert them into NumPy arrays and select our data based on conditions. Finally, we use a scatter plot to visualise the relationship between two variables.