Unit+1+ +Python+for+DS
Unit+1+ +Python+for+DS
saadsheriff1895@gmail.com
J732KOTCSB
Program: MCA
Specialization: Data Science
Semester: 2
Course Name: Python for Data Science
Course Code: 21VMT5S204
Unit Name: Introduction to Python
Learning outcomes:
Knowing about python
Features of python
Installing Anaconda Navigator
Launching Jupyter notebook
Basics about Jupyter notebook
saadsheriff1895@gmail.com
J732KOTCSB
What happens to be amongst the most in-demand programming languages was in-fact
started as a hobby by its creator Guido Van Rossum to keep him occupied during Christmas.
Today, almost all big companies use python for their services in some way or the other.
Amongst the renowned ones are Google, Pinterest, Netflix, Quora, etc.
First things first, what is Python?
Python is a programming language, just like C, C++ and Java. It is a scripting language. It is a
Object-oriented- this means that its paradigm is based on ‘objects’ and ‘classes’. Python is
dynamically typed, meaning, the interpreter gives the variable a type during runtime based
on its value and it does type checking during the same.
Features of Python:
Python has various features, major ones of which are:
Easy to understand: The python code is easy to understand because the syntax is
uncomplicated and in English. Python does not use braces for different functions, it
uses indentation which makes the code look clean and neat, thus making it readable.
High-level language: a high level programming language is that which is user-friendly
and resembles natural human language.
It is an interpreted language: The python code is executed one line at a time unlike
C++ which is executed all at once. The interpreter displays the output one line at
Python IDEs
What is an IDE?
Integrated Development Environment, in easy words, allows programmers to combine
various parts of a program in a single GUI based application. An IDE ideally constitutes of a
source code editor, build automation tools and debugger. There are some IDEs that are
multi-language, like Eclipse and Visual Studio. IDEs are easy to setup, they make
development faster and easier, thus, saving efforts. IDEs also help correct errors and show
where the code is wrong.
In Python, the most frequently used IDEs include Spyder, Jupyter, PyCharm, IDLE and Atom.
For the course, we will be using Jupyter, which is part of the Anaconda distribution.
Anaconda Distribution:
Anaconda distribution is a Python and R data science distribution. It is easy to download and
is open source. It has over 7500 packages. A package is a collection of modules. All of it
freely available and Anaconda also provides community support which is available for all
python related queries one has.
Steps to Install Anaconda:
On the website, click on download for your respective operating system (i.e., Windows,
Mac, Linux)
The site should give you a prompt to save the file, select the location where you
saadsheriff1895@gmail.com
J732KOTCSB want to place the file.
Once downloaded, open it. You should see a prompt like this. Click on next.
Click on ‘I agree’ and do not change any settings/presets that are there. Click on
Next. Specify a destination on the computer. Click Next and it should start the
installation. Once done, click on Next.
saadsheriff1895@gmail.com
J732KOTCSB
Once you are done downloading the Anaconda Navigator, you will be redirected to a
website. For tutorials you can glance over the website and explore.
saadsheriff1895@gmail.com
J732KOTCSB
The ‘8888’ part in the URL might change if another notebook is open in the background.
The files shown on the page are ones that are there on your computer
There are three types of cells in the Jupyter notebook, namely, Code,
Markdown, and Raw Cells.
The Code cells are used to write the code and program. It has to be properly
indented and must have clear syntax.
The Markdown cells are used to document what you write, it is descriptive text.
Raw cells are a place where you can write the output directly. These cells are not
evaluated. They are like comments.
Every cell is a Code cell by default. One can change its type by the drop down on the
Toolbar.
SHORTCUTS
Operation Shortcut Key
Run Ctrl + Enter
Create a new cell Shift + M
Copy a cell c
Paste cell Shift + v
Delete cell Double click ‘d’
Change type of Cell to: Code Y
Change type of Cell to: Markdown M
Change type of Cell to: Raw Cell R
Save (edit checkpoint) Ctrl + S
saadsheriff1895@gmail.com
J732KOTCSB