There are a large number of open-source libraries which can be used while developing AI/ML applications.
Desktop GUI
Desktop GUI offers many toolkits and frameworks using which we can build desktop applications. PyQt, PyGtk, PyGUI are some of the GUI frameworks.
Today, Python is used extensively for doing research especially in the areas of bioinformatics, mathematics, biology, etc. It is a part of Computer Science curriculum for many universities.
It is not just companies that seek through python. Python is used in various fields such as Artificial Intelligence, Astronomy, Internet of Things and Social Science.
In this chapter, we will discuss Python, set up Python environment and the importance of using Python in Data Science. We will also discuss tools and libraries used in Python Programming.
SETTING UP PYTHON ENVIRONMENT
Python is available on different platforms such as Windows, Linux and Mac OS X. We can open Window terminal and type python ; this will return the version of python if it is already installed.
Current documentation, source code, news and updated version of Python are available at: https://www.python.org/
We may download documentation of python in different formats such as PDF, HTML and PostScript format from https://www.python.org/doc/.
For installing Python, we need to download the binary code according to our platform. If binary code for our platform is not available, then we need to compile the code on c compiler manually.
Steps involved in installing Python on Unix/Linux include the following:
Check if python is already installed on machine by going to terminal using Ctrl+Alt+T. For Python2, type python version and For Python3.x, type python3.x version. In case, Python is already installed, then the version of Python installed is returned.
If Python is not installed then follow the following steps:
- Open the URL, https://www.python.org/downloads/.
- Download and extract files from zipped code available for Linux/Unix.
- Execute ./configure script
- Make, make install
The above steps install python libraries at /usr/local/lib/pythonYY. Here YY represents the version of Python installed.
Steps Involved In Installing Python On Windows Include The Following:
- Open the URL, https://www.python.org/downloads/.
- Click on the link python-PQR.msi file and download it. Here, PQR refers to the version of python we wish to install.
- Run the file and this installs python.
Steps involved in installing Python on Macintosh include the following
- Open the URL, https://www.python.org/downloads/.
- MacPython is used for older version of Mac; for Mac which are released before 2003.
Setting Up Path
The executable files and programs may be present in different directory locations. Path consists of a list of directories that comprise executable files that may be searched by the Operating System. Unix is case-sensitive and Windows is not case-sensitive. So, path is PATH in Unix and path in Windows.
Setting Up Path In The Unix/linux
Add python directory to the path using following ways:
- In csh shell, type set env PATH $PATH:/usr/local/bin/python
- In bash shell, type export PATH=$PATH:/usr/local/bin/python
- In ksh shell, type PATH=$PATH:/usr/local/bin/python
We can invoke python using different ways. One way to invoke python is by typing python at the shell command prompt. We may also type help, credits,copyrights and license to get more information about python. We can also open IDLE of Python from START. Python prompt is represented by three greater than sign (>>>). Python commands are written after >>> and return key is hit after each command in order to execute it. The print command in python is used to print a statement. The print command prints the statement and adds a new line after statement.
We can terminate the python session on shell command prompt by typing ctrl-Z in Windows and ctrl-D on Unix.
The file extension of python file is .py. The first line in a python program is #!/usr/local/bin/python. Python consists of a similar structure like other programming languages. Python program may comprise of if/else/elif, while/for, try/except etc.
WHY PYTHON FOR DATA SCIENCE?
Python is a high-level, interpreted and open source language that is based on object-oriented programming concepts. Python is a very popular language these days. Python offers different libraries that help in implementing different data science applications []. Python has the ability to build projects related to statistics, and mathematics and also deal with the scientific function. Python comprises rich set of library that may be imported to build data science related application. The reason why Python is considered a widely used language for building research-based projects and scientific applications is its simple syntax and ease in use .
Python provides deep learning frameworks that are upgraded day by day as well as scientific packages. It is also used extensively in the field of Machine Learning, Natural language Processing, etc.
Following are the characteristics of Python:
- It has a simple syntax and is easy to use.
- It has a huge library package as well as community support.
- It is simple to test python codes, detect and correct errors.
- Modules written in other languages like C/C++ may be appended along with python language.