0% found this document useful (0 votes)
119 views19 pages

People Analytics Python Training String

Here are a few ways to specify the string literal 'foo'bar' in Python: 1. 'foo\'bar' 2. "foo'bar" 3. '''foo'bar''' 4. """foo'bar""" The first option escapes the single quote inside the string using a backslash. The second and third options use double quotes and triple quotes respectively to specify the string literal without needing to escape the inner quote.

Uploaded by

Anish Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
119 views19 pages

People Analytics Python Training String

Here are a few ways to specify the string literal 'foo'bar' in Python: 1. 'foo\'bar' 2. "foo'bar" 3. '''foo'bar''' 4. """foo'bar""" The first option escapes the single quote inside the string using a backslash. The second and third options use double quotes and triple quotes respectively to specify the string literal without needing to escape the inner quote.

Uploaded by

Anish Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 19

— CONFIDENTIAL


People analytics
Python Training

Data Science - Learning Roadmap

Sept to Dec 19

Mid July – Sept

Text Analytics/NLP

Processing and understanding Text


June – mid July Machine Learning Text Classification
Text Summarization
• Introduction to Supervised and Unsupervised
Semantic and Sentiments Analysis
Learning Gensim, Spacy, Stanford NLP, TPOT, CHAID,
• Descriptive & Inferential statistics Factor
• Linear Regression, Decision Trees maximum entropy classifier, document
• k-Fold Cross Validation, Bagging and clustering
Python Basic Bootstrapping
• Random Forest, Gradient Boosting (XGBoost) topic analysis, named entity recognition
• Introduction to Python • Market Basket Analysis, Support Vector part of text tagging, word2vec/doc2vec
• Variables, expressions statements Machine, Naive Bayes
• Conditional statements,Functions
Latent Dirichlet allocation
• Project Work: Apply various ML techniques on
• Strings , Files and Lists, Dictionaries Attrition and ESR Data. Competitive modelling
and Tuples Project: Topic Modeling for Employee
• The Pandas toolkit, The Numpy toolkit Survey/PDA feedback
• Project Work: Data Cleaning and
manipulation of Sample Dataset Project - Sentiments analysis for Employee
Survey feedback
Project - Conversational AI
Deep Learning Text Analysis Techniques

Brief Intro…..

Rule Based Automation

Fuzzy logic

Intelligent Automation

Table Contents

 Introduction to Python - DAY 1


 Installing & Running Python-1 - DAY1
 Preliminaries-0.5 - DAY1
 Variables & Expression statements-0.5 - DAY1
 Data Types – 0.5 - DAY1
 Strings-0.5 - DAY2
 Conditional & Looping-1 - DAY2
 Lists & Lambda function, list comprehension-1 - DAY2, 3
 Dictionaries and Tuples -1 - DAY3
 Sets, Zip, Sorting – 1 - DAY4
 Functions : 0.5 - DAY4
 Regular Expression (Introduction) : 0.5 - DAY4
 Packages & Library-1 - DAY4

2/21/21 Slide 4

Table Contents

 Pandas-2 - DAY5
 Numpy-1 -- DAY6

2/21/21

Introduction to Python

 Creator : Guido Van Rossum


 High level programming-language
 Used for:
• Web Development
• Software Development
• Mathematics
• System scripting
• Data Analysis
 Two Versions : Python 2.7, Python 3.7
 Python Interfaces :
• IDLE
• PythonWin
• Shell

Named the language after the BBC show “Monty Python Flying Circus”.
IDLE: A cross platform python development environment
2/21/21 Slide 6
PythonWin: A Windows only interface to python
Shell: Running Python from command

Installation & Running Python

1) Download Miniconda ‘.exe’ file for Python 3.7 version of windows from given link :
https://docs.conda.io/en/latest/miniconda.html
2) Double click on installer file to start installation
i. Click Next, I agree in further steps…….
ii. When you reach the screen with the Install button, verify the the two Advanced Options checkboxes to Add
Anaconda to my PATH environment variable and to Register Anaconda as my default Python 3.5 are both
checked. Then click Install.
iii. When the install finishes, click Next then Finish.

3) Steps to create Virtual Environment


i. conda create –n ‘yourenvname’ anaconda
ii. Source activate ‘yourenvname’
iii. conda install –n ‘yourenvname’ ‘package_name’
iv. Jupyter
4) To deactivate Virtual Env : source deactivate

Miniconda Installation steps.


2/21/21 Slide 7
For Anaconda Installation : https://www.anaconda.com/distribution/

Preliminaries

 Interpreted Language
• Interpreter Vs compiler
 Object Oriented language
 Dynamically Typed
 Supports tab completion by default
 Support for Macros( Ex: microprocessor)
 Indentation Specifies scope
 Leads to easier to read code
 Memory Allocation

Object Oriented: Inheritance, Abstraction, encapsulation, Polymorphism


2/21/21 Slide 8
Memory Allocation: Reference Pointing, Garbage Collector, GIL

Knowledge Check

Python code is quick but running it is often slower than compiled languages?

2/21/21 Slide 9 Answer and Win………………



Variables & Expression Statements

 Value can vary


 It must be start from uppercase Ascii Character or lowercase Ascii character or (_) underscore.
 Variables are case Sensitive:
 myname = ‘XYZ’ not equals to myName or Myname
 Global or Local Variable
 Comment - #
 DocString – ‘‘‘ This is a multi-line comment’’’
 Expression is a combination of values, variables & Operators.
 Order of operations:
• Parenthesis
• Exponentiation
• Multiplication and Division have same precedence
• Subtraction and Addition have same precedence
Asking user for input (input, raw_input)

2/21/21 Slide 10

Is python Object Oriented?

2/21/21 Slide 11 Ans and win……



Data Types

 Int
 Float
 String
 Complex
 Boolean
 Long(Python 2)
 Type conversion :
• Int : int(a,base)
• Float: float()
• String: str()
• Character to integer: ord()
Mutable vs Immutable:
• Mutable : List, set, Dict
• Immutable: Bool, int, float, tuple, str

Mutable values can change after creation where as for immutable can ‘t.
2/21/21 Slide 12
https://learnpythonforcbse.wordpress.com/2018/07/14/python-data-types-and-operators/.

Continued…

2/21/21 Slide 13

Continued…

 To know data type of variable: type(x)


 To know id of variable: id()
 Object: particular instance of class

2/21/21 Slide 14 Id will reflect identity of an object as an integer value


What are the possible ways to specify string literal foo’bar in python?

2/21/21 Slide 15

Strings

 String is a sequence of Unicode characters.


 S = ‘This is a string’
 Arithmetic Operations on string:
• Word = ‘Hello’
• Print((2*Word))
• Print((2*Word) + ‘World’)
• Print(Word[2]+ ‘ ‘+Word[-1])
 String are immutable : Word[0]= ‘G’ (Note: Item assignment Error)
 Len(Word)
 Word.startswith(‘This’)
 Word.endswith(‘’World’)
 Word.upper()
 Word.lower()

2/21/21 Slide 16 https://www.geeksforgeeks.org/python-strings/



String…

 Word.split()
 Word.strip()
 X, Y = ‘Hello’ , ‘World’
 Word[1:4]
 Formatting : ( New Line: \n , Tab space: \t, backslash: \\)
 Word.find(‘ll’)
 Word.replace(‘e’,’m’)
 Reverse string: Word[::-1]
 Word After one character: Word[1::]
 String Concatenation : Word_concate = ‘Hello’+ ‘ ‘ + ‘World’
 String split: String_variable= ‘Hello Google tell me something’
• String_variable.split(‘ ‘ )
 String Deletion : del Word

2/21/21 Slide 17

String_check = ‘I, am, learning, Python’


1. Split the above given sentence using ‘,’ ?
2. Convert all characters of ‘hello’ to uppercase and save in another variable
3. Write a program to find ‘Apple’ is present in the ‘This is Apple Juice’? (T&C : Don’t use Loops)
4. Write a program that takes your full name as input and displays the abbreviations of the first and
middle names except the last name which is displayed as it is. For example, if your name is “Sachin
Ramesh Tendulkar”, then the output should be ‘S.R.Tendulkar’?

2/21/21 Slide 18
2/21/21 Slide 19

You might also like