Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Intro to python for data science course
1. Python Basics
open source Fee
hckage for DataScience
Version 3 X
1Python Shell PythonScript
可重複輸入
可重複輸出
Variable TM BMI ˇ
與
height
2
height ⼆二 1.79
weight⼆二 68.7
bmi ⼆二 weighty height At 2
print cbmi
zl 4413
2. typecbmi D y this workstoo 30 z true
typecy typecz
float str ⼼心 b001
zt 3 lab't id
5 Lsàbcd
Python Lists Can c 了了
Types
float ⼀一 realnumber
int _integernumber
Str string text
boo1 True False
Each variable represents single value
rests
name a collection of values
Contain any type
typeHam typeCfamz
list Islist
3. Subsetting lists
8 2 6 5 4 3 2 1
T
fam 6
ˋdad
d 不含 fam 3 5
t b
fam 3 5 start end
1.68 mom J
inclusive exclusive
Lts
fam 4 省略略
liz 1.73 emma 1.68 了了
fam 5 jl
l.tl dad 1.893
4. Manipulating Lists
Changing fam 0 2 lisa 1.74
Adding fan time 1.79
Jfamextfam t C me 1.79了了
Remouùg ddcfam 2
yycl
品
áiiisx
iáiz i c 了了
5. Functions
Example⼆二 ⼝口
tallest⼆二
mayHam
a
maxcfam tallest
1.89 ⼼心 ⼈人89
C
roundCl 68,1 or roundCl 68
1.7 2
d helpround
Openupdocumentation
Methods
Functions that belong to objects
egf sister sister capitalize sisterreplace
CY is
it t
y Liz
ˋ
lisa
ex 2 fam append me
ˋ
liz 1.73 em ma 1.68 mom 1 tl dad ⼈人89 he
hm append 1.79 Danger
ˋ
lizl 1.73 emma 1.68 mom 1 tl dad ⼈人89 he 1.79
6. Packages ex
Direct ry of Bthon Scripts
Numpy Matplotlib
Each
scripts module Sci kit team
Install package
Download get_pip py
Tmrnd ⼆二
Python3
getpip
Pypip3 install numpy
Import package
cos
not clear code if long
scripts
7. NumPy
⼈人 Numeric Python
2 Alternative to Python List ⼆二 NumPy Array
3 Calculations over entire arrays
4 Easyand Fast
8
Remarks
NumDyarray contain only one type
Python_list 1,2.3了了
3dtenthumpy_array⼆二
rp array 1,2,3了了 HPE
differentPython_list t Python_list behavior
C1,2,3,1,2,3 了了
humpy_arraythumpy_array
array 2,4,6 D