Introductie tot Python
Hugo Bowne-Anderson
Data Scientist at DataCamp
Functies en methoden zijn super handig
Alle code in Python-distributie?
Enorme codebasis: rommelig
Veel code die je niet gaat gebruiken
Onderhoudsprobleem
Overzicht van Python-scripts
Elk script = module
Specificeer functies, methoden en typen.
Duizenden pakketten beschikbaar
NumPy
Matplotlib
scikit-learn

get-pip.py downloaden
Terminal:
python3 get-pip.py
pip3 install numpy
import numpyarray([1, 2, 3])
NameError: name 'array' is not defined
numpy.array([1, 2, 3])
array([1, 2, 3])
import numpy as npnp.array([1, 2, 3])
array([1, 2, 3])
from numpy import arrayarray([1, 2, 3])
array([1, 2, 3])
my_script.pyfrom numpy import arrayfam = ["liz", 1.73, "emma", 1.68, "mom", 1.71, "dad", 1.89] ...fam_ext = fam + ["me", 1.79] ...print(str(len(fam_ext)) + " elements in fam_ext") ...np_fam = array(fam_ext)
import numpy as np fam = ["liz", 1.73, "emma", 1.68, "mom", 1.71, "dad", 1.89] ...fam_ext = fam + ["me", 1.79] ...print(str(len(fam_ext)) + " elements in fam_ext") ...np_fam = np.array(fam_ext) # Clearly using NumPy
Introductie tot Python