Learn Data Analysis with Python in this comprehensive tutorial for beginners, with exercises included!
Unlock 1 Month of FREE Premium Access to Our Best Courses! 🎓✨ Sign up today and elevate your skills: https://techblazes.com 🚀 (ONLY GOOD FOR THE FIRST 10 PEOPLE TO PARTICIPATE)
Data Analysis has been around for a long time, but up until a few years ago, it was practiced using closed, expensive and limited tools like Excel or Tableau. Python, SQL and other open libraries have changed Data Analysis forever.
In this tutorial you'll learn the whole process of Data Analysis: reading data from multiple sources (CSVs, SQL, Excel, etc), processing them using NumPy and Pandas, visualize them using Matplotlib and Seaborn and clean and process it to create reports. Additionally, we've included a thorough Jupyter Notebook tutorial, and a quick Python reference to refresh your programming skills.
Ready to dive into data analysis with Python? This full course is designed for beginners and covers everything you need to know to get started with Numpy, Pandas, Matplotlib, and Seaborn. Learn how to analyze, visualize, and manipulate data like a pro!
✅ What You’ll Learn:
Numpy: Work with arrays and perform mathematical operations.
Pandas: Manipulate and analyze data with DataFrames.
Matplotlib & Seaborn: Create stunning data visualizations.
By the end of this course, you'll have the skills to tackle real-world data analysis projects. Start your data analysis journey today!
🔔 Subscribe for more data analysis tutorials, Python tips, and coding resources!
Hello and welcome to our Python for Data Science training.
In this course, we will learn to use popular Python libraries used for data science,
such as Pandas, NumPy, and Matplotlib, Seaborn, etc.
And by the end of this training, you will be familiar with the core components of data science,
such as data cleaning, data visualization, and exploratory data analysis.
We will really hope that this course will set you on the right track
to becoming a world-class data scientist.
Welcome to the first part of this course.
In this section, we will be setting up the tools needed for data science,
and we will jog our memory by reviewing some of the key components
of the Python programming language.
So, follow along.
Let's start off by talking a bit about Python.
Python is arguably one of the most popular programming languages of all times,
mainly because of its English-like syntax, built-in functionality, and extensive libraries.
It is interpreted language, which means that the code does not need to be converted
into machine language for execution, ultimately making our code smaller.
It is extensively used in software development,
and is the most popular language in data science, official intelligence, and machine learning.
In this course, we'll be working with Python 3.
Python 2 is an outdated version of Python, and is no longer supported.
The following graph shows the popularity of Python 3 versus Python 2 over the last 5 years,
and as you can see, Python 2 is hardly in the competition.
To install Python in Windows, go to python.org.
Click Downloads.
Download the latest version of Python 3.
At the time of recording this video, the latest version is 3.9.7.
Let's download it now.
After the installation is finished, open the file.
This will open the installation wizard.
Make sure that Add Python 3.9 to Path is checked.
Click Install now.
Wait for the installation to finish.
After the setup is finished, type Python in your search bar, and click Idle,
open brackets, Python 3.9.64-bit, close brackets.
Python Idle will open up.
Python Idle is an integrated development environment for Python,
that allows you to create, modify, and execute Python scripts.
It also provides features like syntax highlighting and auto-completion.
Once Python Idle opens up, print brackets, hello, close all brackets,
and press Enter to execute.
You will see the output in the next line.
To install Python in Mac, head towards python.org.
Click Downloads.
Download the latest version of Python 3.
Once downloaded, open the file.
An installation wizard will open up.
Click Continue.
Click Continue again, and again.
Read and accept the license agreement.
Click Continue.
Next, click Install.
You may be required to enter your password.
Wait for the installation to finish.
If the installation was successful, Python was installed on your machine.
To open Python Idle, search for Idle in your spotlight, and open it.
Type print brackets, hello world, close brackets, and hit Enter to execute it.
In this course, we will be working in Jupyter Notebook.
Jupyter Notebook is a web-based application.
Its cell-based structure allows us to write and run code,
create visualizations, and have narrative text all in one place.
We will be using Anaconda distribution to set up Jupyter Notebook on our machines.
Anaconda is a distribution.
By distribution, we mean that Anaconda is a bundle that contains Python implementations,
as well as the popular tools and libraries used in data science,
such as Jupyter Notebook.
It is like an all-in-one package.
Installing Anaconda will install Jupyter Notebook, Python,
and the popular data science libraries like Pandas, NumPy, and Matplotlib, etc.
on your machine.
To download Anaconda, click on the link given in the slides.
It will take you to Anaconda's website and will automatically detect operating systems.
Click Download.
After the download is finished, open the file.
Click Next.
Read the license agreement and click I Agree.
We recommend choosing Just Me and click Next.
If you want to change destination directory,
click Browse and select your destination folder.
Then click Next.
Click Install.
It takes a while to install.
Once it is installed, click Next.
Click Finish.
If the installation was successful, Anaconda will be installed on your machine.
To launch Jupyter Notebook, search for Anaconda Navigator in your search bar and open it.
Inside the Anaconda program or Anaconda Navigator, you will see a tab called Jupyter.
Launch your Jupyter Notebook by clicking on Launch.
It will launch Jupyter Notebook in your default web browser.
By default, Anaconda runs in your home directory.
We will look into navigating through different directories in a while.
For the time being, click New and then Python 3 to create a new notebook.
The following interface will open up.
We will talk more about the interface soon.
To set up Anaconda on Mac, click on the given link.
Next, click on Started.
Click Download Anaconda Installers.
We recommend installing the graphical installer unless you are comfortable with command line.
In this tutorial, we will be downloading the graphical installer.
Let's click on it.
After the download is complete, double-click on the file to start the installation wizard.
Click Continue.
Read the README file and click Continue.
Read the license agreement and click Continue.
Select Destination Folder and click Continue.
Next, click Install.
If you would like to install PyCharm on your Mac, you can visit the given link.
However, it's not required.
Let's click Continue.
Once the installation finishes, click Close.
If the installation was successful, Anaconda will install on your machine.
Search for Anaconda Navigator in your spotlight and open it.
Launch Jupyter Notebook.
This will launch Jupyter Notebook in your browser.
Create a new notebook by clicking on New and then Python 3.
An empty Jupyter Notebook will open in another tab.
We will talk more about the interface at a later stage.
To set up Anaconda on Ubuntu, open your terminal by pressing Ctrl, Alt and T.
Copy-paste the following command and hit Enter.
Next, copy-paste this command and hit Enter again.
Next, we move to the Downloads directory by giving the following command.
Once in the Downloads directory, copy-paste the following command
in your terminal and hit Enter.
Next, give the following command and hit Enter.
When prompted, hit Enter again.
License Agreement will now be displayed on your screen.
To scroll through License Agreement, keep pressing the Enter key.
Read the agreement and then type Yes and hit Enter.
Press Enter to install Anaconda in the Home directory.
After a while, Anaconda will be installed on your machine.
When asked, do you wish the installer to initialize Anaconda 3 by running conda init,
type Yes and hit Enter.
After the installation is successfully finished, restart your terminal.
You will now see Base written before your directory name.
This is the command line interface for Anaconda which runs on the Ubuntu terminal.
To launch Jupyter Notebook, type Jupyter Notebook without the quotation marks and hit Enter.
This will launch Jupyter Notebook in your default browser.
To create a new Jupyter Notebook, click on New and then Python 3.
An empty Jupyter Notebook will open in another tab.
We will talk more about the interface soon and now on to the next lecture.
This is Jupyter Notebook, interface that we saw earlier.
Jupyter Notebook has a cell-based structure which allows us to have
code, visualization, mathematical equations and narrative text all at one place.
You can have as many cells as we want.
For the time being, let's just stick to writing Python code in Jupyter Notebook.
In the cell, type print brackets hello world close brackets and click on the Run button.
The output of a cell is produced right below it.
Now on to the next lecture.
Next, we will have a look at managing directories in Jupyter Notebook.
To open Jupyter Notebook in a particular directory, copy the path of that directory.
In your search bar, type Anaconda prompt and open it.
Anaconda prompt is the command line interface for Anaconda.
This will open Anaconda prompt in your Windows directory.
If your desired directory is in a different drive, you need to first change the drive.
In this case, we want to move to drive D.
We type D and hit enter.
Note that Anaconda prompt is not case sensitive.
Next, to move to the desired directory inside the D drive,
we give the command cd and then paste the path that we had copied earlier.
Hit enter.
Finally, to launch Jupyter Notebook, type Jupyter Notebook without quotation marks and hit enter.
After a while, Jupyter Notebook will open up in your default browser.
If you have an existing notebook in your directory, you can open it by clicking on it.
Otherwise, you can create a new notebook.
Let's click on this hello.ipynb to open it.
Our hello.ipynb contains just one line of code, a print statement.
To open Jupyter Notebook in a specific directory in Mac, open the directory in Terminal.
Type Jupyter Notebook without the quotation marks and hit enter.
After some time, Jupyter Notebook will launch in your browser.
You will be able to see the files in the directory where Jupyter Notebook is running.
In this case, we have one notebook called hello.ipynb.
Let's open it by clicking on it.
This is our hello.ipynb file with just one print function.
Now, onto the Ubuntu operating system.
To open Jupyter Notebook in a particular directory,
open that directory in the Terminal by right-clicking and selecting Open in Terminal.
Type Jupyter Notebook without quotation marks and hit enter.
It takes a while to launch Jupyter Notebook.
After some time, Jupyter Notebook will launch in your default browser.
As you can see, we already have a notebook called hello.ipynb.
Let's open it by clicking on it.
And here you go.
hello.ipynb contains a single line of code, a simple print function.
That was all for managing directories in Jupyter Notebook.
And now onto the next lecture.
In this lecture, we'll have a look at inputs and outputs in Python.
To print something on the screen, we use the print function.
To print a message, we pass it to the print function as a string.
Let's print a simple hello world message on screen.
We type print brackets hello world brackets.
Let's select this cell and click on the run button to execute it.
And here you go.
We have the output on our screen.
Next, let's have a look at how to take input from the user.
To take user input, we use the input function.
Pretty intuitive, right?
Let's see it in action.
Let's take input from the user by asking about their name.
We will create a variable.
We call it name and then name equals input brackets enter your name close all brackets.
In the next line, we print what the user has entered.
So we say print brackets welcome comma name close all brackets.
We select this cell and run it.
Let's enter some name here.
I will enter James and hit enter.
And there you go.
We see the output on the screen.
Time for a small quiz.
Which of the following is the correct syntax for the input function?
If you choose B, your answer is correct.
Python has four primitive data types.
Two numeric, which are int and float.
And two non-numeric, which are string and boolean.
Python also has some built-in data structures or non-primitive data type,
including lists, dictionaries and tuples.
Let's quickly revise the primitive data types.
An int is an integer or whole number.
A float is a decimal point number.
A string is a sequence of characters, which can be any combination of letters,
numbers, whitespaces and special characters.
A bool is either true or false.
To get the data type of a value in Python, we use the type function.
It returns us the data type of a value,
which can then be print on screen using the print function.
And now on to the next lecture,
in which we'll go through the variables in Python.
Python is a dynamically typed language as opposed to statically typed language.
Which means that the Python checks the data types of variables at runtime.
Hence, we do not need to declare the data type of a variable at the time of creating it.
Python assigns data types to variables itself, depending on the value stored in them.
Make sure to read the rules for variable names to avoid syntax errors.
Now, let's create some variables.
So, x equals one.
To print the value of a variable,
we pass the name of the variable to the print function without the quotation marks.
Let's print x on screen.
Print brackets x, close all brackets.
Let's select this cell and run it.
And we see the output on the screen.
Let's create a variable of typing string.
Name equals put quotation marks gems.
Let's go ahead and print this variable on screen.
So, print name.
We run this cell and we have the output on screen.
Remember the rules for variable names.
Which one of the following variable names satisfies all of the rules?
For the second question, identify the correct syntax for printing the value of a variable.
The correct variable name is underscore name.
And the correct syntax is option d.
Recall that we do not put quotation marks when printing a variable.
In this lecture, we'll be exploring the arithmetic operation in Python.
They are pretty simple.
Let's get started.
We use the plus sign for addition, minus sign for subtraction, and asterisk for multiplication.
For the division, we have two types of operators.
A single slash is used for float division and always returns a float.
Double slash is used for integer division and always returns an integer.
If the result of an integer division is a float,
then the decimal part is truncated to make it an integer.
We also have a modular operator which returns the remainder of the division.
Here are some examples of arithmetic operations in Python.
Print, open bracket, five plus three, close bracket.
Print, open bracket, 6.5 minus two, close bracket.
Print, open bracket, two times four, close bracket.
Ready for a small quiz?
Answer the following questions.
What is the correct output of the float division between four and two?
Remember, the result has to be a float.
What is the correct output of the integer division between four and two?
Remember, the result has to be an integer.
What is the correct output of nine divide by two?
Here are the correct answers.
How many did you get right?
Comparison operators are used to compare two values.
They return either true or false depending upon the comparison.
Here is a list of comparison operators in Python.
greater than, forward arrow, less than, reverse arrow, greater than or equal to,
forward arrow, equals, less than or equal to, reverse arrow, equals, not equal to,
exclamation mark, equals, is equal to, equal sign, equal sign.
And that's it pretty much.
Now on to the next lecture.
Next up is logical operators.
Logical operators are used to combine two or more conditions.
There are three logical operators in Python.
AND, OR, AND, NOT.
Let's go through each one of these.
An operator returns true only if all of the conditions are true.
Otherwise, it returns false.
Let's have a look at an example.
In this demo, we'll be looking at the AND operator.
Let's go ahead and type print.
In this case, the first condition is true.
But the second condition is false.
So AND should return a false.
Let's go ahead and run this cell to confirm.
And yes, it does say false.
Now on to the OR operator.
The OR operator returns a true if at least one of the conditions is true.
It returns a false only if all of the conditions are false.
Let's have a look at an example.
In this demo, we'll be looking at the OR operator.
Let's go ahead and type print.
In this case, the first condition is true.
And the second condition is false.
So OR should return true.
Let's run this cell to confirm.
And here you go, it says true.
Now on to NOT operator.
NOT is a unary operator, meaning that it takes only one operand.
It reverses a true to false and false to true.
Let's do an example of NOT operator in Jupyter Notebook.
In this demo, we'll see how NOT operator works.
In this cell, let's type x equals true, print x, print NOT x.
Our variable is x is set to true.
So print x should print true on screen.
Print NOT x should print the opposite of x on screen, which is false.
Let's run this cell to see.
Select the cell and run it.
And we see true and then false on screen.
OK, so quick questions.
Predict the output of each of these comparisons operators.
In this lecture, we'll talk about conditional statements in Python.
There are three conditionals.
IF, ELSE and ILIF.
We start with IF followed by an ILIF, which is followed by an ELSE.
Both ILIF and ELSE are optional.
The conditions are evaluated in a top-down manner.
If the IF condition is true, its block is executed and the rest of the ILIF and ELSE are skipped.
If the IF condition is false, first ILIF condition is checked.
If it is true, its block is executed and all the other ILIF and ELSE are skipped and so on.
If none of the IF and ILIF is true, only the ELSE block is executed.
Let's have a look at conditional statements in Jupyter Notebook.
Let's create a small program using conditional statements.
We say, IF 5 == 6 print bracket 1 close bracket ILIF 6 == 6 print bracket 2 bracket ELSE print
bracket 3 bracket close full brackets.
Since the first of conditions is false, it checks the first ILIF condition.
Since this is true, it prints 2 on screen and skips the ELSE block.
We can also combine conditions using the logical operators that we discussed earlier.
Just see how we're combining conditions in this piece of code using the AND operator.
And now on to the next lecture.