SLIDE 1
Python for Data Processing and Plo3ng
Han-Wei Shen The Ohio State University (with help from Jonathan Woodring at Los Alamos NaConal Laboratory)
SLIDE 2 What is Python?
- Fast code development and test
- A dynamically typed language
– You do not need to declare the type of a variable
- Syntax is very much C-like
- A huge number of packages for
doing almost everything (numpy, scipy, matplotlib, …)
- AutomaCc memory management
- FuncCons can be passed around as
arguments
- Can bind to C code easily for speed
(from Jonathan Woodring, Los Alamos NL)
SLIDE 3
Variable Assignment
SLIDE 4
More Assignment
SLIDE 5
Lists
SLIDE 6
Slicing Lists
SLIDE 7
Slicing Lists
SLIDE 8
IteraCng Lists with Loops
SLIDE 9
IteraCng Lists with Loops
SLIDE 10
If-Then-Else
SLIDE 11
Tuples are Immutable
SLIDE 12
DicConaries
SLIDE 13
FuncCon DefiniCons
SLIDE 14
File I/O
SLIDE 15 NumPy
- The most popular package for scienCfic compuCng
– Efficient N-dimensional arrays – Useful for linear algebra, data transformaCon etc.
- Get Numpy from hYp://www.scipy.org
SLIDE 16 NumPy
- The most popular package for scienCfic compuCng
– Efficient N-dimensional arrays – Useful for linear algebra, data transformaCon etc.
- Get Numpy from hYp://www.scipy.org
SLIDE 17
NumPy Slicing
SLIDE 18
NumPy Array Reshaping
SLIDE 19
NumPy Array BroadcasCng
SLIDE 20
NumPy Linear Algebra
SLIDE 21
NumPy I/O
SLIDE 22 Matplotlib
- Python 2D plo3ng package that produces publicaCon quality figures
- Get it from hYp://matplotlib.org
SLIDE 23
Line Graphs
SLIDE 24
Images
SLIDE 25
Histograms