Python - Basics
Python - Basics
Free Registration
30 Days
Data Scinece &
Analytics Master
Class
Handbook
What is Master
Class ?
👍 This is the 30 Days Industrial Learning Activity.
Python
Library
Pandas
Analytics
Tools Industry Project
Numpy Distribution
Introduction To MatplotLib Visualization PowerBi Project Building,
Python and Python Cborn, SKLearn Tableo DSA Jobs
Data Structures Lib Aggregation
Collab Statistics
Day wise Learning Plan
Day -1 : Python for Data
Science (5 Solved end-to-end Data Science Projects in Python)
Day -2: Advanced Python Programming
Day -3: Pandas Library – Introduction
Day -4: Pandas Library – Data Structures
Day -5: Numpy library – Array Operations | Mathematical
Functions
Day -6: Numpy – Sort, Search and Counting Functions
Day -7: Matplotlib , Histogram Using Matplotlib | I/O With
Numpy
Day -8: Matplotlib Library – Introduction , Pyplot API | Types Of
Plots
Day -9: Seaborn Library
Day -10: SKLearn Library
Day -11: Google Colab Notebook
Day -12: Python – Date and Time, Data Wrangling
Day -13: Python – Data Aggregation
Day -14: Python – Word Tokenization , Stemming and
Lammetization
Day -15: Python – Data Visualization
Day wise Learning Plan
Day -16: Python – Statistical Analysis
Day -17: Python – Types Of Distribution
Day -18: Python – Correlation ,Chi-Square Test , Linear Regression
Day -19: Tableau – Introduction and Tools
Day -20: Tableau – Data Sources , Worksheets
Day -21: Spatial Data Science For Covid-19 Disease Prediction
Day -22: Power-BI – Introduction, Installation Steps and Architecture
Day -23: Power-BI – Data Modelling , Visualization Options | Excel Integration
Day -24: Parkinson’s Disease Prediction – XG Boost Classifier
Day -25: House Price Prediction using Random Forest Regression
Day -26: Customer Segmentation Using ML – K-Means Clustering
Day -27: Home Loan Prediction using Decision Tree Classifier
Day -28: Spam Classification using NLP
Day -29: Hand Written Digit Recognition Using CNN
Day -30: Churn Prediction using Deep Learning
List of Projects for Demo in YouTube Live
1. Spatial Data Science For Covid-19 Disease Prediction
2. Parkinson’s Disease Prediction-XGBoost Classifier
3. House Price Prediction-Random Forest Regression
4. Customer Segmentation Using ML-K-Means Clustering
5. Home Loan Prediction-Decision Tree Classifier
6. Spam Classification-NLP
7. Hand Written Digit Recognition Using Python-CNN
8. Churn Prediction-Deep Learning
9. Crop Yield Prediction
10.Ground water level prediction
https://www.pantec
helearning.com/dat
a-science-master-cl
ass/
What is
Internship???
?
Learn
Practice
Verify
Get Certified
Grow
Free Master Class DSA 1 Month Internship on DSA
Master Class Participation Internship Completion Certificate
Certificate
Minimum 25 Class should attend Recorded Class Link will be provided. – LMS Portal
YouTube Live Access
YouTube Live Mandatory Your Choice. You can attend Live or else You can
watch Recorded Class in LMS Portal
All Projects Demo class in Step by Step Video Explanation Content in LMS
YouTube Live Portal
Access : 3 Days VIP WhatsApp Group Support
You Can Download All PPTs
4 Nos of Hackathon Class in Zoom Live. The
Recording also will be provided
You Can Download All Project Files
Mentor will guide you to finish 10 Projects
Access : 60 Days
Objective of this 30 Days Master Class
Click
Here
Coupon Code:
WELCOMEDSE
DATA SCIENCE
What is Data Science?
Data science is an interdisciplinary field that uses scientific methods,
processes, algorithms and systems to extract knowledge and insights from
data, and apply knowledge from data across a broad range of application
domains.
Python
Introduction
Python is :
1. High-level programming language.
2. Fast to learn and fast to develop application.
3. Available for many platforms.
4. Implement complex logic with very few lines of code.
History
Two integer objects with values 1 and 2 are assigned to variables a and b
respectively.
One string object with the value “john” is assigned to the variable c.
Python – Variable Types
Standard Data Types:
The data stored in the memory can be of many types.
A person’s age is stored as a numeric value and his address is stored as
alphanumeric characters.
Python has 5 standard data types:
Python – Variable Types
Numbers
String
List
Tuple
Dictionary
Python – Variable Types
Python Numbers:
Number data types store numeric values.
Number objects are created when we assign a value to them.
Var1 = 1
Var2 = 10
Python – Variable Types
We can also delete a reference to the number object using the del statement.
del var1[,var2[,var3[....,varN]]]]
We can delete a single object or multiple objects using the del statement.
del var
del var_a, var_b
Python – Variable Types
Python supports four different numerical types:
Int(signed numbers)
Long(long integers , they also can be represented in octal and
hexadecimal).
Float(floating point real values).
Complex(complex numbers).
Python – Variable Types
Python - Strings:
Strings in python are identified as a contiguous set of characters represented in
quotation marks.
Subsets of strings can be taken using the slice operator([] and [:]) with indexes
starting at 0 in the beginning of the string .
They work their way from -1 to the end.
The plus (+) sign is the string concatenation operator , asterick(*) is the
repetition operator.
Python – Variable Types
#!/usr/bin/python
str = 'Hello World!'
print (str) # Prints complete string
print (str[0]) # Prints first character of the string
print (str[2:5]) # Prints characters starting from 3rd to 5th print str[2:] # Prints
string starting from 3rd character
print (str * 2) # Prints string two times
print (str + "TEST“) # Prints concatenated string
Python – Variable Types
Hello World!
H
llo
llo World!
Hello World!Hello World!
Hello World!TEST
Python – Variable Types
Python Lists:
Sequence is the most basic data structure in python.
Each element of a sequence is assigned a number – its position or index.
The most common python sequences are lists and tuples.
Several operations can be performed in a sequence like indexing , slicing ,
adding and multiplying.
Python - Lists
A list is nothing but a collection of comma separated values between square brackets.
The items in a list need not be of the same type.
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"]
#!/usr/bin/python
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5, 6, 7 ];
print ("list1[0]: ", list1[0])
print ("list2[1:5]: ", list2[1:5])
Output:
list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
Updating Lists:
We can update single or multiple elements of the lists by giving the slice
!=: If the values of two operands are not equal , then the condition
becomes true.
(a!=b) is true.
Python – Comparison Operators
>: If the value of left operand is greater than the value of right operand ,
then the condition becomes true.
(a>b) is not true.
Python – Logical Operators
a = 10, b = 20
Logical AND: If both the operands are true , then the condition becomes true.
(a and b) is true
Logical OR: If any of the two operands are non-zero , then the condition
becomes true.
(a or b) is true.
Python – Logical Operators
Logical NOT: Used to reverse the logical state of its operand.
Not(a and b) is false.
Python – Decision Making
Decision making is an anticipation of conditions occuring while execution
of the program.
Decision structures evaluate multiple expressions which produce TRUE or
FALSE as outcome.
Python – Decision Making
Python – Decision Making
Python programming language assumes non-zero values as true and the
zero values as false.
There are three different types of decision making statements:
If statements:
An if statement consists of a boolean expression followed by one or more
statements.
Python – Decision Making
If…else statements:
An if statement can be followed by an optional else statement , which
executes when the boolean expression is false.
Nested if statements:
We can use one if or else if statement inside another if or else if statements
Example - If
#!/usr/bin/python
var = 100
if ( var == 100 ) : print ("Value of expression is 100”)
print ("Good bye!”)
Output:
Value of expression is 100
Good bye!
Python - Loops
Statements are executed sequentially.
The first statement in a function is executed first , followed by the second
and so on.
Programming languages provide various control structures that allow for
more complicated execution paths.
Python - Loops
Python - Loops
While loop:
Repeats a statement or a group of statements till the condition is true.
It tests the condition before executing the loop body.
For loop:
Executes a sequence of statements multiple times and abbreviates the code that manages the loop
variable.
Nested loop:
We can use one or more loop inside any another while , for or do.. While loop.
Loop Control Statement:
Loop Control Statements change execution from its normal sequence.
Following are the different types of loop control statements.
Break statement:
Terminates the loop statement and transfers execution to the statement immediately
following the loop.
Continue statement:
Causes the loop to skip the remainder of the body and immediately retest its condition
prior to reiterating.
Loop Control Statement:
Pass statement:
The pass statement is used when a statement is required syntactically but
we do not want any command or code to execute.
Python - Numbers
Number data types store numeric values.
They are immutable data types , means that changing the value of a
number data type results in a newly allocated object.
Var1 = 1
Var2 = 10
Python - Numbers
We can also delete single object or multiple object using the del statement.
del (var)
del (var_a, var_b)
Python - Strings
Strings are the most popular types in python.
It can be created by enclosing characters in quotes.
#!/usr/bin/python
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5, 6, 7 ];
print "list1[0]: ", list1[0]
print "list2[1:5]: ", list2[1:5]
Output:
list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
Python - Lists
Updating Lists:
We can update single or multiple elements of lists by giving the slice on
the left – hand side of the assignment operator .
We can add to elements in the list with the append() method.
Python - Lists
Updating Lists:
#!/usr/bin/python
list = ['physics', 'chemistry', 1997, 2000];
print ("Value available at index 2 : “)
print (list[2])
list[2] = 2001;
print ("New value available at index 2 : " )
print (list[2])
Output:
Value available at index 2 :
1997
New value available at index 2 :
2001
Python - Lists
Delete List Elements:
To remove an element from the list , we can use either the del statement if
we know exactly which elelments we are deleting or the remove method if
we do not know.
Python - Lists
#!/usr/bin/python
list1 = ['physics', 'chemistry', 1997, 2000];
print (list1)
del (list1[2]);
print ("After deleting value at index 2 : “)
print (list)
Output:
['physics', 'chemistry', 1997, 2000]
After deleting value at index 2 :
['physics', 'chemistry', 2000]
Basic List Operations:
Lists respond to the “+” and “*” operators like strings.
Python - Lists
Indexing , Slicing and Matrixes:
L = ['spam', 'Spam', 'SPAM!']
Python - Tuples
A tuple is a collection of objects which ordered and immutable.
Tuples are sequences , like lists.
The difference between lists and tuples is that tuples cannot be changed unlike lists
and tuples use parentheses , whereas a list use square brackets.
#!/usr/bin/python
tup = ('physics', 'chemistry', 1997, 2000);
print tup;
del tup;
print "After deleting tup : ";
print tup;
Output:
('physics', 'chemistry', 1997, 2000)
After deleting tup :
Traceback (most recent call last):
File "test.py", line 9, in <module>
print tup;
NameError: name 'tup' is not defined
Python - Dictionary
Each key is separated from the value by a colon, the items are separated by
commas and the whole thing is enclosed within curly braces.{}.
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Name': 'Manni'}
print "dict['Name']: ", dict['Name']
Output:
dict['Name']: Manni
Properties Of Dictionary Keys
Keys must be immutable.
It means we can use strings , numbers or tuples as dictionary keys but
something like[‘key’] is not allowed.
#!/usr/bin/python
◦ dict = {['Name']: 'Zara', 'Age': 7}
◦ print ("dict['Name']: ", dict['Name'])
Output:
Traceback (most recent call last):
File "test.py", line 3, in <module>
dict = {['Name']: 'Zara', 'Age': 7};
TypeError: unhashable type: 'list'
Python - Functions
A function is a block of organized , reusable code that is used to perform a
related action.
Functions provide better modularity and code reusability.
Defining a Function
Function blocks begin with the def keyword followed by the function name and parentheses(()).
Any input parameters should be placed within these parentheses.
Syntax:
def functionname( parameters ):
"function_docstring"
function_suite
return [expression]
Example:
def printme( str ):
"This prints a passed string into this function"
print (str)
return
Calling a Function
Defining a function only gives it a name, specifies the parameters that are
to be included in the function and structures the blocks of code.
Calling a Function
#!/usr/bin/python
# Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
# Now you can call printme function
printme("I'm first call to user defined function!")
printme("Again second call to the same function")
Output:
I'm first call to user defined function!
Again second call to the same function
Pass By Reference Vs Value
All the parameters in python language are passed by reference.
If you change what a parameter refers to within a function , the change
also reflects back in the calling function.
Example:
#!/usr/bin/python
# Function definition is here
def changeme( mylist ):
"This changes a passed list into this function"
mylist.append([1,2,3,4]);
print "Values inside the function: ", mylist
return
# Now you can call changeme function
mylist = [10,20,30];
changeme( mylist );
print "Values outside the function: ", mylist
Output:
Values inside the function: [10, 20, 30, [1, 2, 3, 4]]
Values outside the function: [10, 20, 30, [1, 2, 3, 4]]
Pass By Reference (Example 2):
#!/usr/bin/python
# Function definition is here
def changeme( mylist ):
"This changes a passed list into this function"
mylist = [1,2,3,4]; # This would assig new reference in mylist
print "Values inside the function: ", mylist
return
Pass By Reference (Example 2):
# Now you can call changeme function
mylist = [10,20,30];
changeme( mylist );
print "Values outside the function: ", mylist
Output:
Values inside the function: [1, 2, 3, 4]
Values outside the function: [10, 20, 30]
Function Arguments
Required arguments
Keyword arguments
Default arguments
Variable – length arguments
Function Arguments
Required Arguments:
They are the arguments passed to a function in correct positional order.
The number of arguments in the function call should exactly match with
the function definition.
Function Arguments
#!/usr/bin/python
# Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
# Now you can call printme function
printme()
Output:
Traceback (most recent call last):
File "test.py", line 11, in <module>
printme();
TypeError: printme() takes exactly 1 argument (0 given)
Function Arguments
Keyword Arguments:
They are related to the function calls.
When we use keyword arguments in a function call , the caller identifies
the arguments by the parameter name.
Function Arguments
Keyword Arguments:
#!/usr/bin/python
# Function definition is here
def printme( str ):
"This prints a passed string into this function"
print str
return;
# Now you can call printme function
printme( str = "My string")
Function Arguments
Output:
My string
Function Arguments
Keyword Arguments:
#!/usr/bin/python
# Function definition is here
def printinfo( name, age ):
"This prints a passed info into this function"
print "Name: ", name
print "Age ", age
return;
# Now you can call printinfo function
printinfo( age=50, name="miki" )
Function Arguments
Output:
Name: miki
Age 50
Function Arguments
Default Arguments:
A default argument is an argument that assumes a default value if the value
is not provided in the function call for that argument.
Function Arguments
#!/usr/bin/python
# Function definition is here
def printinfo( name, age = 35 ):
"This prints a passed info into this function"
print "Name: ", name
print "Age ", age
return;
# Now you can call printinfo function
printinfo( age=50, name="miki" )
printinfo( name="miki" )
Output:
Name: miki
Age 50
Name: miki
Age 35
Variable Length Arguments
#!/usr/bin/python
# Function definition is here
def printinfo( arg1, *vartuple ):
"This prints a variable passed arguments"
print "Output is: "
print arg1
for var in vartuple:
print var
return;
# Now you can call printinfo function
printinfo( 10 )
printinfo( 70, 60, 50 )
Output:
Output is:
10
Output is:
70
60
50
The Return Statement
The statement return exits a function , optionally passing back an
expression to the caller.
Example:
#!/usr/bin/python
# Function definition is here
def sum( arg1, arg2 ):
# Add both the parameters and return them."
total = arg1 + arg2
print "Inside the function : ", total
return total;
# Now you can call sum function
total = sum( 10, 20 );
print "Outside the function : ", total
Output:
Inside the function : 30
Outside the function : 30
Global Vs Local Variables:
Variables that are defined inside a function body have local scope and
those defined outside have a global scope.
Local variables can be accessed only inside the function in which they are
declared , whereas global variables can be accessed throughout the
program body by all functions.
Example:
#!/usr/bin/python
total = 0; # This is global variable.
# Function definition is here
def sum( arg1, arg2 ):
# Add both the parameters and return them."
total = arg1 + arg2; # Here total is local variable.
print "Inside the function local total : ", total
return total;
# Now you can call sum function
sum( 10, 20 );
print "Outside the function global total : ", total
Output:
Inside the function local total : 30
Outside the function global total : 0
Follow us on:
Instagram--https://instagram.com/pantechelearning?igshid=1fohp030onteu
Telegram--https://t.me/pantechelearning
YouTube--https://youtube.com/c/PantecheLearning.
Podcasts--https://www.instagram.com/tv/COPQIigJZFi/?igshid=4gjhz4dlls1p
After Internship Registration what you have to
do?
1.Login to www.pantechelearning.com
2.Access the Video on daily basis for next 30 Days.
Practice the Concept and submit assignments
3.Ask your doubts in VIP Group. Group link is avail in your
dashboard.
4.Finish all the videos and download your Certificate from
your dashboard
Internship Certificate (Sample)
Projects
Included in
Internship.
Pantech will make you to Create 10 Projects in
Data Science Engineering in 30 Days
30 Days Internship on Machine Learning Master
Class
Reg Link: https://imjo.in/Rb6xqe
Discount Coupon Code: WELCOMEML
Happy
learning
Call / whatsapp : +91
9840974408
THANK
S
Further Information:
www.pantechelearning.com |
CREDITS: This presentation template was created by
Slidesgo, including icons by Flaticon, and infographics &
[email protected]
images by Freepik