Hey welcome to this new section and in this section you'll learn how to use Pandas which is a very important
Python library and you really don't want to miss that.
So what is Pandas?
Well Pandas is a library providing data structures and data analysis tools within Python
Or if the word tools confuses you then you can say Pandas is a library providing data structures and data
analysis code.
So basically Pandas allows you to load data from different sources into Python and than use Python code
to analyze those data and produce results which can be in the form of tables, text and also visualization
.
With the help of visualization and libraries such as Bokeh which is covered later in of course
.
So for now we'll focus on data without visualizing them and Pandas is great for that.
So practically how do we use Pandas? Well, you learnt how to open text files using Python built in
file handling methods earlier in the course.
Now what we opened from text files was just plain text.
But what if you want to load text files with data constructed of rows and columns?
So things get a bit complicated but here is where Pandas comes into play.
So you can probably do that using built in Python methods that we have learned in the course but to
be more efficient and to be much more efficient you need to have a high level library such as Pandas which
is able to recognize such a data structure so automatically.
So I use Pandas for loading data from data mining activities such as web scrapping so you scrap
data from a website with Python and then store those data are in Pandas data frames.
So you use Pandas to provide data structures for you in Python. And I use Pandas for loading data from
Excel files and also use Pandas for analyzing those data instead of using Excel.
Excel can be good for analyzing a small table of data that that fits in your screen, in your computer
screen but for data larger than that
you really want to use code.
So you write Python code once and you reuse it with other data as well and you don't want to do
selections and dragging and many other cumbersome operations that you normally do in a graphical
based program such as Excel.
So code is the way to go if you want to be efficient with data.
And Python is great for that
with Pandas. So you really want to get a good hang of Pandas and you will learn that in this section and
also practice it with real world applications that we will be building as you progress through the course
.
Now that's enough with words.
Let's go ahead and install Pandas. You want to open the terminal and the process is straightforward.
You say: Pip install Pandas.
Now I mentioned that Pandas is a high level library and Pandas is based on Numpy which you can see
in here.
So Pandas is now trying to install Numpy because without Numpy you cannot use Pandas.
Numpy is a more low level library than Pandas. We will cover Numpy later on.
But I wanted you to know Pandas first because that is more easy to understand.
So once you know how to use Pandas, then you think about Numpy and Ill show you how Numpy is the base of
Pandas.
So let's not think about Numpy now.
Yeah, so this was successful.
But if for any reason it wasn't successful on your side and I know that in some windows distributions
you may get an error such as this one here. So it says: Unable to find this bat file.
And that happens to be because Pandas is trying to compile itself but it cannot find a compiler
.
So in that case the easiest solution that you can do is to use precompiled Python libraries which you can
find in this case in this website.
So they're provided by Chris Gholke.
Now you want to locate Numpy first.
So here is Numpy. You click that and that goes down here and then you want to pick up your version
.
So if you have Python 3.5 youd want to go for this cp35 and then you have 32 bits of windows and 64
.
So you want to pick your own bits.
So what you do is you download that that is whl file which is the same file that you install
with Pip but with Pip you download it and then you install it. In this case the download is being done manually
and then we point to this file with Pip again to install.
Ill show how to do that.
And once that file is downloaded successfully Ive put in here in my C drive C PP and then you want
to either CD to that directory and then use Pip install and then start typing in the name of that file.
Tab to get the complete file name.
Now you should pres enter and that will install Numpy for you.
Once you are done with Numpy, than you go ahead and get Pandas as well. Pandas. These are the distributions
.
Again you get 3.5 if you have the 3.5 version for Python and the Windows version as well.
And you repeat the same process.
I hope that is clear. Once you install Pandas then you can simply go ahead import it.
There is no error and you are good to go.
So that was about an introduction to Pandas and how to install it.
Let's go ahead and dive into some code now in the next lectures. See you.