Foundation of Data Science: Unit IV: Python Libraries for Data Wrangling

Introduction to Python

Features, Advantages and Disadvantages of Python

Python is a high-level scripting language which can be used for a wide variety of text processing, system administration and internet-related tasks.

Introduction to Python

• Python is a high-level scripting language which can be used for a wide variety of text processing, system administration and internet-related tasks.

• Python is a true object-oriented language, and is available on a wide variety of platforms.

• Python was developed in the early 1990's by Guido van Rossum, then at CWI in Amsterdam, and currently at CNRI in Virginia.

• Python 3.0 was released in Year 2008.

• Python statements do not need to end with a special character.

• Python relies on modules, that is, self-contained programs which define a variety of functions and data types.

• A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.

• Within a module, the module's name (as a string) is available as the value of the global variable_name_.

• If a module is executed directly however, the value of the global variable_name will be "_main_".

• Modules can contain executable statements aside from definitions. These are executed only the first time the module name is encountered in an import statement as well as if the file is executed as a script.

• Integrated Development Environment (IDE) is the basic interpreter and editor environment that you can use along with Python. This typically includes an editor for creating and modifying programs, a translator for executing programs, and a program debugger. A debugger provides a means of taking control of the execution of a program to aid in finding program errors.

• Python is most commonly translated by use of an interpreter. It provides the very useful ability to execute in interactive mode. The window that provides this interaction is referred to as the Python shell.

• Python support two basic modes: Normal mode and interactive mode

• Normal mode: The normal mode is the mode where the scripted and finished.py files are run in the Python interpreter. This mode is also called as script mode.

• Interactive mode is a command line shell which gives immediate feedback for each statement, while running previously fed statements in active memory.

• Start the Python interactive interpreter by typing python with no arguments at the command line.

• To access the Python shell, open the terminal of your operating system and then type "python". Press the enter key and the Python shell will appear.

C:\Windows\system32>python

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>> 

• The >>> indicates that the Python shell is ready to execute and send your commands to the Python interpreter. The result is immediately displayed on the Python shell as soon as the Python interpreter interprets the command.

• For example, to print the text "Hello World", we can type the following:

>>> print("Hello World")

Hello World

>>> 

• In script mode, a file must be created and saved before executing the code to get results. In interactive mode, the result is returned immediately after pressing the enter key.

• In script mode, you are provided with a direct way of editing your code. This is not possible in interactive mode.

Features of Python Programming

1. Python is a high-level, interpreted, interactive and object-oriented scripting language.

2. It is simple and easy to learn.

3. It is portable.

4. Python is free and open source programming language.

5. Python can perform complex tasks using a few lines of code.

6. Python can run equally on different platforms such as Windows, Linux, UNIX, and Macintosh, etc

7. It provides a vast range of libraries for the various fields such as machine learning, web developer, and also for the scripting.

Advantages and Disadvantages of Python

Advantages of Python

• Ease of programming

• Minimizes the time to develop and maintain code

•Modular and object-oriented

•Large community of users

• A large standard and user-contributed library

Disadvantages of python

• Interpreted and therefore slower than compiled languages

• Decentralized with packages

Foundation of Data Science: Unit IV: Python Libraries for Data Wrangling : Tag: : Features, Advantages and Disadvantages of Python - Introduction to Python