intro to object oriented programming in p y thon
play

Intro to Object Oriented Programming in P y thon W OR K IN G W - PowerPoint PPT Presentation

Intro to Object Oriented Programming in P y thon W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON Vicki Bo y kis Senior Data Scientist WORKING WITH THE CLASS SYSTEM IN PYTHON What ' s Object - Oriented Programming ? ( OOP ) A w a y to b u


  1. Intro to Object Oriented Programming in P y thon W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON Vicki Bo y kis Senior Data Scientist

  2. WORKING WITH THE CLASS SYSTEM IN PYTHON

  3. What ' s Object - Oriented Programming ? ( OOP ) A w a y to b u ild � e x ible , reprod u cible code De v eloping b u ilding blocks to de v eloping more ad v anced mod u les and libraries WORKING WITH THE CLASS SYSTEM IN PYTHON

  4. Imperati v e St y le and OOP St y le Imperati v e our_list = [1,2,3] for item in our_list: print(f"Item {item}") OOP class PrintList: def __init__(self,numberlist): self.numberlist = numberlist def print_list(self): for item in self.numberlist: print(f"Item {item}") A = PrintList([1,2,3]) A.print_list() WORKING WITH THE CLASS SYSTEM IN PYTHON

  5. All P y thon libraries w ork together WORKING WITH THE CLASS SYSTEM IN PYTHON

  6. Let ' s get started ! W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON

  7. Introd u ction to N u mP y Internals W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON Vicki Bo y kis Senior Data Scientist

  8. What ' s N u mP y? N u mP y is a package for scienti � c comp u ting in P y thon . Uses matrices and v ectors as data str u ct u res Perfect for data science , w here data is laid o u t in table - like formats WORKING WITH THE CLASS SYSTEM IN PYTHON

  9. N u mP y as a b u ilding block to Pandas WORKING WITH THE CLASS SYSTEM IN PYTHON

  10. Creating N u mP y arra y s So u rce : DataCamp WORKING WITH THE CLASS SYSTEM IN PYTHON

  11. N u mP y Arra y e x ample E x ample : import numpy as np our_array = np.array([2,3,4]) print(our_array) [2 3 4] print(type(our_array)) <type 'numpy.ndarray'> WORKING WITH THE CLASS SYSTEM IN PYTHON

  12. Creating M u lti - Dimensional Arra y s E x ample 1: array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14]]) E x ample 2: array([6, 7, 8]) WORKING WITH THE CLASS SYSTEM IN PYTHON

  13. Let ' s practice ! W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON

  14. Introd u ction to Objects and Classes W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON Introd u ction to Classes Vicki Bo y kis

  15. What is a class ? class PrintList: A re u sable ch u nk of code that has methods and v ariables . def __init__(self,numberlist): self.numberlist = numberlist def print_list(self): for item in self.numberlist: print(f"Item {item}") A = PrintList([1,2,3]) A.print_list() WORKING WITH THE CLASS SYSTEM IN PYTHON

  16. OOP Vocab u lar y WORKING WITH THE CLASS SYSTEM IN PYTHON

  17. A Class is a template for an object WORKING WITH THE CLASS SYSTEM IN PYTHON

  18. Declaring a Class Declaring a class class Dinosaur: pass # Used in Python 3, with/without parentheses class Dinosaur(): pass # Used in Python 2 class Dinosaur(object): pass An object is an instance of a class . Tyrannosaurus = Dinosaur() WORKING WITH THE CLASS SYSTEM IN PYTHON

  19. Let ' s practice ! W OR K IN G W ITH TH E C L ASS SYSTE M IN P YTH ON

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend