SlideShare a Scribd company logo
1 of 11
Python for Data Science
Week 2
What we learnt this week ?
 Sequence Data Types
 Strings
 Lists
 Tuple
 Dictionary
 Sets
 Numpy
What are Sequence Data Types ?
 Sequence Data Types allows us to store multiple values in an organized and
efficient fashion.
 String, List, Tuple are some example of Sequential types
 Dictionaries and Sets are container for Non-sequential data.
Strings
 String is an immutable sequence data type.
 Immutable – which can’t be changed
 It is the sequence of Unicode characters wrapped inside single, double, or triple
quotes.
 Example:
 ‘This is a string in Python’
 “This is a ‘string’ in Python”
 ‘“This is a “string” in Python”’
Functions/Methods on String
 string*n - repeats the given string n times
 upper() - Converts a string into upper case
 lower() - Converts a string into lower case
 split() - Splits the string at the specified separator, and returns a list
 index() - Searches the string for a specified value and returns the position of where it is
found
 count() - Returns the number of times a specified value occurs in a string
 capitalize() – Returns the string with its first character capitalized and the rest lowercased
Lists
 A list is an ordered and mutable Python container.
 Lists are used to store multiple items in a single variable.
 Lists are created using square brackets
 Example:
 myList = [1 , 2 , 3 , 4 , 5]
 myList = [1 , ‘two’ , 3 , ‘four’ , 5]
 myList = [1 , [‘a’ , ‘b’ , ‘c’] , ‘hello’]
Functions/Methods on Lists
 append() - Adds an element at the end of the list
 pop() - Removes the element at the specified position
 clear() - Removes all the elements from the list
 insert() - Adds an element at the specified position
 reverse() - Reverses the order of the list
 extend() - Add the elements of a list (or any iterable), to the end of the current list
Dictionary
 Used to store data values in key:value pairs.
 Dictionaries are written with curly brackets, and have keys and values
 Syntax:-
{'key1':'value1','key2':'value2'}
 Duplicates not Allowed
Dictionaries cannot have two items with the same key.
 Example
mydictionary = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
Numpy and Numpy Array
 Numpy is a Python package and it stands for numerical python.
 A numpy array is a grid of values, all of the same type.
 To install numpy on your system, run this command on your CMD
pip install numpy
 To create numpy array, we first need to import the numpy package:
import numpy as np
 Example:-
array = np.array([1,2,3,4,5], dtype = int )
Methods/Functions
 type(array) – this will give you the Datatype of Array
 len(array) – length of array
 array.ndim - return the number of dimensions of an array
 array.shape - returns a tuple with each index having the number of
corresponding elements
 array.reshape – it changes the shape of the array
Thank You
For your Patience

More Related Content

Similar to PPT data science python sequence numpy.pptx

ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
SukhpreetSingh519414
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
MCCMOTOR
 

Similar to PPT data science python sequence numpy.pptx (20)

Data structures in Python
Data structures in PythonData structures in Python
Data structures in Python
 
Python data type
Python data typePython data type
Python data type
 
Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...Processing data with Python, using standard library modules you (probably) ne...
Processing data with Python, using standard library modules you (probably) ne...
 
Data types in python
Data types in pythonData types in python
Data types in python
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
 
dataStructuresInPython.pptx
dataStructuresInPython.pptxdataStructuresInPython.pptx
dataStructuresInPython.pptx
 
13- Data and Its Types presentation kafss
13- Data and Its Types presentation kafss13- Data and Its Types presentation kafss
13- Data and Its Types presentation kafss
 
UNIT 1 - Revision of Basics - II.pptx
UNIT 1 - Revision of Basics - II.pptxUNIT 1 - Revision of Basics - II.pptx
UNIT 1 - Revision of Basics - II.pptx
 
unit-4 regular expression.pptx
unit-4 regular expression.pptxunit-4 regular expression.pptx
unit-4 regular expression.pptx
 
ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
 
Python_Unit_III.pptx
Python_Unit_III.pptxPython_Unit_III.pptx
Python_Unit_III.pptx
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
 
Lists_tuples.pptx
Lists_tuples.pptxLists_tuples.pptx
Lists_tuples.pptx
 
ACP-arrays.pptx
ACP-arrays.pptxACP-arrays.pptx
ACP-arrays.pptx
 
Python ds
Python dsPython ds
Python ds
 
Arrays Introduction.pptx
Arrays Introduction.pptxArrays Introduction.pptx
Arrays Introduction.pptx
 
set.pptx
set.pptxset.pptx
set.pptx
 
Python data handling notes
Python data handling notesPython data handling notes
Python data handling notes
 
Python list
Python listPython list
Python list
 
Numpy
NumpyNumpy
Numpy
 

Recently uploaded

如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
qyguxu
 
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOALBLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
CaitlinCummins3
 
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
MasterG
 
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
qyguxu
 
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
Hector Del Castillo, CPM, CPMM
 
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
qyguxu
 
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
qyguxu
 
Genaihelloallstudyjamheregetstartedwithai
GenaihelloallstudyjamheregetstartedwithaiGenaihelloallstudyjamheregetstartedwithai
Genaihelloallstudyjamheregetstartedwithai
joceko6768
 
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
qyguxu
 

Recently uploaded (20)

如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
如何办理(UW毕业证书)滑铁卢大学毕业证成绩单原件一模一样
 
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
如何办理(Indiana State毕业证书)印第安纳州立大学毕业证成绩单原件一模一样
 
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
如何办理(Monash毕业证书)莫纳什大学毕业证成绩单原件一模一样
 
Kathleen McBride Costume Design Resume.pdf
Kathleen McBride Costume Design Resume.pdfKathleen McBride Costume Design Resume.pdf
Kathleen McBride Costume Design Resume.pdf
 
CV OF Dr. David Burkett | Cardiologist and Electrophysiologist .
CV OF Dr. David Burkett | Cardiologist and Electrophysiologist .CV OF Dr. David Burkett | Cardiologist and Electrophysiologist .
CV OF Dr. David Burkett | Cardiologist and Electrophysiologist .
 
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
如何办理(KCL毕业证书)伦敦国王学院毕业证成绩单原件一模一样
 
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOALBLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
BLAHALIFHKSDFOILEWKHJSFDNLDSKFN,DLFKNFMELKFJAERPIOAL
 
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
Ralph - Project Presentation Enhancing System Security at Acme Flight Solutio...
 
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
如何办理(Galway毕业证书)爱尔兰高威大学毕业证成绩单原件一模一样
 
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
WIOA Program Info Session | PMI Silver Spring Chapter | May 17, 2024
 
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
如何办理(EUR毕业证书)鹿特丹伊拉斯姆斯大学毕业证成绩单原件一模一样
 
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
如何办理(CBU毕业证书)浸会大学毕业证成绩单原件一模一样
 
Your 7-Step Job Application Checklist: Ace Your Next Career Move
Your 7-Step Job Application Checklist: Ace Your Next Career MoveYour 7-Step Job Application Checklist: Ace Your Next Career Move
Your 7-Step Job Application Checklist: Ace Your Next Career Move
 
HCE 5400 Practice Test: Key Concepts and Sample Questions
HCE 5400 Practice Test: Key Concepts and Sample QuestionsHCE 5400 Practice Test: Key Concepts and Sample Questions
HCE 5400 Practice Test: Key Concepts and Sample Questions
 
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
如何办理(UoA毕业证书)奥克兰大学毕业证成绩单原件一模一样
 
The Best VFX Course with Job Placement near Dunlop
The Best VFX Course with Job Placement near DunlopThe Best VFX Course with Job Placement near Dunlop
The Best VFX Course with Job Placement near Dunlop
 
Job Hunting - pick over this fishbone for telephone interviews!.pptx
Job Hunting - pick over this fishbone for telephone interviews!.pptxJob Hunting - pick over this fishbone for telephone interviews!.pptx
Job Hunting - pick over this fishbone for telephone interviews!.pptx
 
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
如何办理(UNTEC毕业证书)新西兰联合理工学院毕业证成绩单原件一模一样
 
Genaihelloallstudyjamheregetstartedwithai
GenaihelloallstudyjamheregetstartedwithaiGenaihelloallstudyjamheregetstartedwithai
Genaihelloallstudyjamheregetstartedwithai
 
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
如何办理(CSU毕业证书)圣马科斯分校毕业证成绩单原件一模一样
 

PPT data science python sequence numpy.pptx

  • 1. Python for Data Science Week 2
  • 2. What we learnt this week ?  Sequence Data Types  Strings  Lists  Tuple  Dictionary  Sets  Numpy
  • 3. What are Sequence Data Types ?  Sequence Data Types allows us to store multiple values in an organized and efficient fashion.  String, List, Tuple are some example of Sequential types  Dictionaries and Sets are container for Non-sequential data.
  • 4. Strings  String is an immutable sequence data type.  Immutable – which can’t be changed  It is the sequence of Unicode characters wrapped inside single, double, or triple quotes.  Example:  ‘This is a string in Python’  “This is a ‘string’ in Python”  ‘“This is a “string” in Python”’
  • 5. Functions/Methods on String  string*n - repeats the given string n times  upper() - Converts a string into upper case  lower() - Converts a string into lower case  split() - Splits the string at the specified separator, and returns a list  index() - Searches the string for a specified value and returns the position of where it is found  count() - Returns the number of times a specified value occurs in a string  capitalize() – Returns the string with its first character capitalized and the rest lowercased
  • 6. Lists  A list is an ordered and mutable Python container.  Lists are used to store multiple items in a single variable.  Lists are created using square brackets  Example:  myList = [1 , 2 , 3 , 4 , 5]  myList = [1 , ‘two’ , 3 , ‘four’ , 5]  myList = [1 , [‘a’ , ‘b’ , ‘c’] , ‘hello’]
  • 7. Functions/Methods on Lists  append() - Adds an element at the end of the list  pop() - Removes the element at the specified position  clear() - Removes all the elements from the list  insert() - Adds an element at the specified position  reverse() - Reverses the order of the list  extend() - Add the elements of a list (or any iterable), to the end of the current list
  • 8. Dictionary  Used to store data values in key:value pairs.  Dictionaries are written with curly brackets, and have keys and values  Syntax:- {'key1':'value1','key2':'value2'}  Duplicates not Allowed Dictionaries cannot have two items with the same key.  Example mydictionary = { "brand": "Ford", "model": "Mustang", "year": 1964 }
  • 9. Numpy and Numpy Array  Numpy is a Python package and it stands for numerical python.  A numpy array is a grid of values, all of the same type.  To install numpy on your system, run this command on your CMD pip install numpy  To create numpy array, we first need to import the numpy package: import numpy as np  Example:- array = np.array([1,2,3,4,5], dtype = int )
  • 10. Methods/Functions  type(array) – this will give you the Datatype of Array  len(array) – length of array  array.ndim - return the number of dimensions of an array  array.shape - returns a tuple with each index having the number of corresponding elements  array.reshape – it changes the shape of the array
  • 11. Thank You For your Patience