Best Python Training in Dehradun Data Science Step by Step

Introduction to Python for data science

The new oil is data. This statement demonstrates how data capture, storage, and analysis are at the heart of every modern IT system. It doesn’t matter if you’re making a business choice, forecasting the weather, investigating protein structures in biology, or creating a marketing strategy. All of these scenarios call for a multidisciplinary approach that includes the use of mathematical models, statistics, graphs, databases, and, of course, the commercial or scientific rationale that underpins the data analysis. As a result, we need a programming language that can handle all of these different data science requirements. Python stands out as one of these languages since it comes with a plethora of libraries and built-in capabilities that make it simple to meet the demands of data research.

Python has libraries

Python contains a number of libraries that contain a significant number of mathematical functions and analytical tools.

The following libraries will be used in this course:

Pandas – This library is used to do structured data operations such as importing CSV files, creating dataframes, and preparing data.

Numpy is a library for mathematicians. There’s an N-dimensional array object, linear algebra, and the Fourier transform, among other things.

Matplotlib is a library that allows you to visualise data.

SciPy is a Python library that includes linear algebra modules.


Comments are text blocks that live in your code but are disregarded by the Python interpreter when it runs it. You can use comments to describe the code so that you and other developers can understand what it does and why it’s written the way it is. Simply add a hash mark (#) before your remark text to make a comment in Python:

Example : # This is a comment on its own line


In Python, variables are names tied to a particular object. They keep a reference to the memory address where an item is stored, often known as a pointer. Once a variable has been assigned to an object, the object can be accessed by using the variable name.

You must declare your variables advance. The syntax is as follows:

num = 100 #num is of type int
str = “Chaitanya” #str is of type string


Identifiers - Variable name

The term “identifier” refers to the name of a variable. When naming variables in Python, there are a few guidelines to follow.

1. The variable’s name must always begin with a letter or an underscore ( ). For example, the variables _str, str, num, and _num are all allowed names.

2. The variable’s name must not begin with a number. 9num, for instance, is not an acceptable variable name.

3. Variable names cannot contain special characters like percent, $, or #; they must only contain alphanumeric characters and underscore (A to Z, a to z, 0-9, or ).

4. In Python, variable names are case sensitive, therefore num and NUM are two separate variables.

Python Variable Example

num = 100
str = “VistaAcademy”

practice in below 

What is the meaning of a Python keyword?

A reserved term in Python is one that you can’t use as the name of a variable, class, function, or anything else. These keywords have a specific meaning and are used in the Python programming language for specific purposes.

Here is a list of the Python keywords. Enter any keyword to get more help.

False            def           if                          raise
None             del          import                   return
True              elif          in                              try
and              else          is                         while
as                 except    lambda                 with
assert           finally    nonlocal                  yield
break           for            not
class           from            or
continue     global                                  pass

Example of Variable

Example of Python keyword
num = 10
while num>5:
num -= 1

Python data Type

Numeric Types


Integer –

In Python 3, there is no upper bound on the integer number which means we can have the value as large as our system memory allow

x = 20

#display x:

#display the data type of x:


It is automatically inferred based on the value we are assigning to a variable. For example here fnum is a float data type.

# float number
fnum = 34.45
print(“Data Type of variable fnum is”, type(fnum))

Complex Number

x = 1j

#display x:

#display the data type of x:

Python Data Type – String

String is a sequence of characters in Python. The data type of String in Python is called “str”.

Strings in Python are either enclosed with single quotes or double quotes.
# Python program to print strings and type

s = “This is a String”
s2 = ‘This is also a String’

# displaying string s and its type







Python Data Type – Tuple

In Python, a tuple is an unchanging data type, which means it cannot be modified. It’s a list of elements that are separated by commas and enclosed in round brackets.

t1 = (1, 2, 3, 4, 5)
# prints entire tuple

# tuple of strings
t2 = (“hi”, “hello”, “bye”)
# loop through tuple elements
for s in t2:
print (s)

# tuple of mixed type elements
t3 = (2, “Lucy”, 45, “Steve”)
Print a specific element
indexes start with zero

Python Data Type – List

List is similar to tuple in that it is an ordered collection of elements. However, unlike tuple, list is a changeable data type, which means it can be altered.

# list of integers
lis1 = [1, 2, 3, 4, 5]
# prints entire list

# list of strings
lis2 = [“Apple”, “Orange”, “Banana”]
# loop through list elements
for x in lis2:
print (x)

# List of mixed type elements
lis3 = [20, “Chaitanya”, 15, “BeginnersBook”]
Print a specific element in list
indexes start with zero
print(“Element at index 3 is:”,lis3[3])

Boolean Values

In programming you often need to know if an expression is True or False.

You can evaluate any expression in Python, and get one of two answers, True or False.

Example 1

print(10 > 9)

print(10 == 9)

print(10 < 9)

Example 2

a = 200
b = 330

if b > a:
print(“b is greater than a”)
print(“b is not greater than a”)


Operator in Python

+ addition

x = 5
y = 3

print(x + y)


x = 5
y = 3

print(x – y)


x = 6
y = 3

print(x * y)


x = 12
y = 7

print(x / y)



x = 5
y = 2

print(x % y)



x = 2
y = 5

#shows remender of division

print(x ** y) #same as 2*2*2*2*2

//Floor division

x = 15
y = 2

print(x // y)

#the floor division // rounds the result down to the nearest whole number

Python Assignment Operators

x +=

x = 5

x += 3


#answer will be 8


x = 5

x -= 3


#answer will be 2


x = 5

x *= 3


#answer will be 15 


x = 5

x /= 3



x = 5



#shows remainder 2


x = 5



#shows result in integer 2


x = 5

x **= 3

#mutiply 5*5*5


x = 5

x &= 3



Python Logical Operator


Logical AND: True if both the operands are true.


Logical OR: True if either of the operands is true x or y

# Print a and b is False
print(a and b)

# Print a or b is True
print(a or b)

# Print not a is False
print(not a)


10 steps to start career in data science 5 Data Analytics Projects for Beginners 5 Excel Data Analysis Functions You Need to Know 5 Things in Your Resume from Getting Your First Job in Data Science Best Data Analytics training in Dehradun Why to learn Best Data science Training in Dehradun Categories of SQL command to know for Data Analysis Data Analyst vs. Business Analyst: What’s the Difference? Data Cleaning With Python for data analytics Data Science Case Studies given by Top Data Scientists