When buying any of my courses, I also give you free coupons to the rest of my courses. Just send me a message after enrolling. Pay one course, get 5!!
This course is intended for students aiming to learn Python, with no previous programming experience. After this course, the student will have a general overview of the Python programming language. In order to master Python, the student will need more practice, and more specific training in some areas. Nevertheless, with this course, the student will be familiar with most elements in the Python environment.
We start by explaining how to install and set up the Python environment, and then how to define variables, loops, numbers, and functions. We then review the basics behind Numpy, which is a critical package for mathematics in Python. We then explain the fundamental elements of the Python standard library such as pulling data from the web, storing persistent data, working with decimal numbers, and creating visual applications. Because analysing raw numbers is sometimes a complicated task, we also show how to leverage the powerful Matplotlib package for creating plots. We then review one of the most important elements of Python: Classes. We start with a very simple class, and we then build more complicated ones explaining different aspects.
People working with Python, will most likely need to build applications processing data. And because Python is the most used statistical and machine learning programming language, we finally review the data science packages triad in Python: Pandas (data processing), Scikit-learn (machine-learning), and Statsmodels (statistics). The idea of this part is to introduce the basics behind these packages.
At the end of the course, the student should be able to:
You will find lots of exercises and quizzes!
We try to keep this course as updated as possible, and the student is welcome to formulate questions, as we try to answer them promptly.
We explain how to work with lists, which are one of the most important objects in Python. We explain how to do basic operations with them such as retrieving a particular element, add new ones, getting the max and min, and sorting them.
Lists in Python
One central characteristic of every programming language is its ability to execute statements conditionally. In this case, we explain how to write if/else conditions in Python. This will be of prime importance for the following lessons
We review how to execute loops in Python by using the "for" and "while" statements. Combining these results, with the previous lesson on "if" statements, will allow you to write any program that you can imagine.
Do you know how to use a while statement?
The input() function allows us to get input from the user. We use it to get a list from the user
We introduce the different variable types in Python, such as strings, numbers, dates, and lists. This will serve as a basis for later studying each variable type with more detail
One of the fundamental variable types in Python. We study how to append strings, remove spaces, replace characters, and change some characters.
String basics in Python
We explain the basic functionality of the math package included in Python. We then show how to operate with float and integers in Python.
We review the most important aspects when dealing with dates in Python, and how to work with datetime, date, and timespan objects. We show how to create datetime objects in different ways, how to add days and months to a particular date, and how to use pull the different attributes contained in a datetime/date object.
Dates in Python
Data structures provide a very convenient way of storing and retrieving data in a very fast way. We analyze queues, dictionaries, stacks, lists and some specific ways of looping through these structures.
Brief overview of data structures
Functions provide a convenient way of organising our code, making our code much more readable. We explain how to use them in Python.
Numpy is the fundamental package for mathematics in Python. It allows us to work with the famous numpy.array which is an incredibly flexible and powerful object. In this lesson, we also work with numpy matrices and some mathematical functions that Numpy provides
Why do we use Numpy?
Python allows us to load code from modules, thus simplifying our code. An even more interesting feature, is Python's ability to group different modules under a same package. We show how to write and load both modules and packages.
Python standard library allows us to do a wide array of things, such as working with decimal numbers, storing dictionaries as permanent data, creating UI interfaces, and working with pathnames. In this lesson we review some of its most important capabilities.
Every programming language is capable of writing and reading files. In this lesson we explain how to do it in Python.
A fantastic package called matplotlib allows Python to produce excellent plots using minimal code. This provides Python with a fantastic edge over many programming languages. In this lesson we review the basics behind this package.
Python is an object oriented language, which means that it is designed to work with objects. Classes are the fundamental component behind object oriented programming. In this lesson we see how to define classes, which encapsulate methods and data.
In this lesson we explain how to define classes inheriting from base classes (this is called inheritance). This yields a fundamental division between classes: base classes being the parent classes, and derived classes being the children classes. As an example, we can think that animal is a base class, and elephant is a derived class that inherits from animal.
As you might expect this causes a separate discussion, how can we block another programmer from instantiating an "animal" class? (animals really don't exist, since it is an abstract concept). This leads us to a separate discussion on "abstract" classes.
We then explain how to write functions in derived classes that overwrite the functionality in their parent (base) classes, a functionality in object oriented languages called polymorphism.
The idea is to practice the basics behind classes in Python
Most programmers working in Python, will be required to work with data (since Python is the most important language for data science). That leads us to a problem, because we don't have powerful data processing functions in Python's base functions.
Pandas is the best data processing package for Python. It allows us to load and process data very easily and efficiently. We introduce Python's elementary object: the dataframe
We delve into the most important functions in data processing/Pandas: how to subset data? how to merge data-sets? how to create pivot tables and how to transpose the data?
Python is increasingly used by machine learning practitioners and data scientists. And many employers require that their Python programming teams have some familiarity with Scikit-learn. The objective of this lesson is to introduce you to the typical machine learning problems (supervised and unsupervised), and show you how to install and use the powerful Scikit-learn package. In order to give you a general overview of this library, we explain how to use it to group the observations into two clusters, and then to predict the labels/categories for a classification problem (where we want to classify customers into three groups). Naturally, in order to master Scikit-learn the student will certainly need to spend many extra hours, as it is one of the most complex Machine-learning packages.
Statistical modelling is used for understanding the relationship between certain variables. It typically requires an active interaction between the programmer and the code producing the results. This interaction for example would be: deciding which variables to keep, removing certain observations which are weird, etc. Machine learning (scikit-learn) is a different approach which builds algorithms that can learn by themselves with little or no human interaction.
As most Python programmers will be required to work with data, it is important to understand how to build models to describe that data. In the previous lesson we described how to use machine learning techniques (scikit-learn) to do that. In this lesson we introduce Statsmodels, which is used for statistical modelling in Python. We show how to install it, and use it for a simple linear regression case. We then move into a different approach, where we get some temporal yearly data, and want to predict values for other years.
Understand the basics behind ML and stats in Python
Let's check how much you know about this package
I worked for 7+ years exp as statistical programmer in the industry. Expert in programming, statistics, data science, statistical algorithms. I have wide experience in many programming languages. Regular contributor to the R community, with 3 published packages. I also am expert SAS programmer. Contributor to scientific statistical journals. Latest publication on the Journal of Statistical Software.