Ch1 Slides
Ch1 Slides
Hello Python!
Intro to Python for Data Science
Python
● Guido Van Rossum
● General Purpose: build anything
● Open Source! Free!
● Python Packages, also for Data Science
● Many applications and fields
● Version 3.x - h!ps://www.python.org/downloads/
Intro to Python for Data Science
IPython Shell
Execute Python commands
Intro to Python for Data Science
IPython Shell
Intro to Python for Data Science
Python Script
● Text Files - .py
● List of Python Commands
● Similar to typing in IPython Shell
Intro to Python for Data Science
Python Script
Intro to Python for Data Science
DataCamp Interface
Script
Shell
INTRO TO PYTHON FOR DATA SCIENCE
Let’s practice!
INTRO TO PYTHON FOR DATA SCIENCE
Variable
● Specific, case-sensitive name
● Call up value through variable name
● 1.79 m - 68.7 kg
In [3]: height
Out[3]: 1.79
Intro to Python for Data Science
Calculate BMI
In [1]: height = 1.79
In [7]: bmi
Out[7]: 21.4413
Intro to Python for Data Science
Reproducibility
! my_script.py
height = 1.79
weight = 68.7
bmi = weight / height ** 2
print(bmi)
Output:
21.4413
Intro to Python for Data Science
Reproducibility
! my_script.py
height = 1.79
weight = 74.2
bmi = weight / height ** 2
print(bmi)
Output:
23.1578
Intro to Python for Data Science
Python Types
In [8]: type(bmi)
Out[8]: float
In [9]: day_of_week = 5
In [10]: type(day_of_week)
Out[10]: int
Intro to Python for Data Science
In [13]: type(y)
Out[13]: str
In [14]: z = True
In [15]: type(z)
Out[15]: bool
Intro to Python for Data Science
Let’s practice!