Application of Residue Theorem to evaluate real integrations.pptx
Python with data Sciences
1. Python with Data Sciences
By - Krishna Mohan Mishra
Reg.No.-11605503
2. Introduction
• Python is a Object Oriented programming and scripting
language.
• It was created by Guido van Rossum.
• It first appeared on 20 February 1991.
Features :
*Platform independent * fewer lines of code
*Interpreted language *code reusability
Applications:
*YouTube
*Google Search Engine
*Dropbox
3. Python Types
Strings:
• Strings are ordered blocks of text
• Written inside quotes(both single and double quotes can be used
Ex- str1=”Calibri”
-str2=‘Calibri'
Operators , Methods & Testing Conditions
5. Python Types
Sets:
Sets are unordered mutable sequences
of unique elements.
Tuples:
Tuples are unordered immutable sequences .
6. Dictionary
• Unordered mutable collection of mapping obj
• Values accessed by keys
• Heterogenous
• Can be nested
• Can vary in size
• Modifiable in place
• Hash table for efficiency
• Both dictionary and lists are heterogeneous ,
can contain any python types.
7. Functions
• A function is created with def keyword
• The statements in the block must be indented
• The def keyword is followed by the function
name with round brackets and a colon
• The indented statements form body of a
function
For ex :
Built in functions:
8. Files
• File Handling is very important concept of
Python.
• File is used to save the data permanently
on disk.
• File has specific name and directory path.
• File operations are read, write and search.
READ
10. Classes & Objects
Class − A user-defined prototype for an object that defines a set of attributes.
The class statement creates a new class definition.
The self parameter is the reference to the class itself, and it is used to access the
variables that belong to the class.
All classes have a function called __init__(), which is always executed when the class
is being initiated
11. Exception Handling
• An exception is an event , which
occurs during the execution of
program that stops normal flow of
the program’s instructions
• When Python script raises exception it
must either handled or terminate.
• Exception are handled using the try
and except keywords.
Example:
1.
2.
12. Regular Expressions
• Specialized programming language embedded in
python
• Based on rules definition , and applying to a string
• Useful for complex pattern matching
Steps :
1. Submit a regex string
2. Compile the string to get a regex byte code
3. Apply the compiled regex byte code to target string
4. Obtain the result of the match
5. Use the results.
Metacharacters : A metacharacter is a character that
has a special meaning to a computer program such as a
regular expression engine.
13. Regular ExpressionsMethods:
1. re.match(pattern, string)-finds match if it occurs at start of the string.
Ex- import re
result=re.match(r’AV’, ‘AV Analytics Vidhya AV’)
print(result.group(0))
2. re.search(pattern, string)-finds match at any place in the string
3. re.findall(pattern,string)-list of all matching patterns
4. re.split(pattern,string,maxsplit=0)-splits string by occurrence of given pattern
Ex- result=re.split(r’y’ , ‘Analytics’)
print(result) # o/p – [‘Anal’ , ’tics’]
5. re.sub(pattern,repl,string)-search and replace
Ex- re.sub(r’India’ , ‘the World’ , ‘AV is largest Analytics community of India’)
print(result)
o/p- AV is largest Analytics community of the World
15. Web Scraping
pip (Pip Installs Packages)- a package manager for python ,that that can help to
expand the module list that we have with the standard installation.
install- pip install <package name>
list of installed package- pip list
uninstall- pip uninstall <package name>
Web Scrapping- To extract content from the web and process it to create useable
data and analytics for wide spectrum of applications.
At the core of it the process is to download a web page , and parse its html content
to extract areas of interest .this is then converted to a data form for further analysis
and presentation.
16. Web Scraping
Retrieving web pages using “urllib.request”
Web Scraping using BeautifulSoup package.