Python is a beginner friendly simple programming language that was created between 1985- 1990 by Guido van Rossum.
It may seem very basic and not that sophisticated as other languages but be assured that it has all the capabilities of other new and highly developed programming languages.
Along with having all the features object oriented programming it is also has high-level data structures and is an interpreted scripting language.
The python source code is available under the GNU General Public License (GPL) on its official website.
Today the application of python are vastly diversified from Web development to data science.
Python is easy to lean for beginner and easy to grip for experienced developers in a short duration.
Python is available for development over most of the modern operating systems.
To create and run our application in python we must set up a proper environment for it and install the necessary dependencies.
Below are the necessary software which needs to be installed on your computer to create your first application in python:
- Visit https://www.python.org/downloads/ and download one of the following versions.
I recommend going with Python 3.6.x version because 3.6.4 is the latest version which will most likely remain stable while 2.7.x is just released to support legacy code.
- While installing python you need to select this option as it is very important and will help us further as we progress
After this click Install Now and let the software install itself
- Now launch IDLE (Python 3.6 32 bit) which will be installed in your PC if everything is installed properly
As we can see IDLE is just a python shell but if you want to you could write your code in a separate IDE as there are many paid and free IDE’s for python but for this basic demonstration we will stick to this simple shell
Now to creating your first program in python
Python is similar to Pearl, Java and C in terms of syntax but however there are some key differences in this languages which we observe as we code.
To print out code in our shell we need to write
>>> print (‘welcome to python’)
And now press enter to execute the above line
You will see the output in your next line
You can save you code on your machine by providing the file name and adding
.py extension which marks it as python file.
Below is the code to know a data type of a particular value and to add two numbers
In the above lines of code output is marked in Green
Data Science requires a language to be simple, easy to learn, being highly readable and having an abundance of good libraries.
All the above requirements are ticked in python.
Python also has very powerful statistical and numerical packages already available with a huge community support.
- Pandas and NumPy (Python Data Analysis Library): This libraries allow us to read/manipulate data efficiently and easily. NumPy has evolved from Numeric which has been in development since mid-1990.
- Matplotlib: This allows us to create useful and powerful data visualizations.
- Scikit-learn: It is a special library that enables us to train and apply machine learning algorithms to your data and make predictions.
- Cython: This library allows us to convert our python code and then run the code in C environment to effectively reduce the runtime and improve our general model performance.
- PyMySQ: This library allows us to easily connect to MySQL database, extract data and execute queries.
- BeautifulSoup: It can be used to easily read in XML and HTML type data which is quite common nowadays.
- iPython: IPython notebook provides us with a web-based interactive environment just like R programming
Python in general had a very long history of being supported by large community of developers for Data science and numerical analytics.