SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline

Scientific Python
Eueung Mulyana
http://eueung.github.io/python/sci
Hint: Navigate with Arrow Keys | Attribution-ShareAlike CC BY-SA
1 / 31
Agenda
1. Jupyter / IPython
2. NumPy
3. SciPy
4. matplotlib
5. pandas
6. SymPy
7. scikit-learn
8. jakevdp: The State of the Stack
2 / 31
 Jupyter / IPython
3 / 31
IPython
Powerful interactive shell
Supports tab completion of just about everything
Inline help system for modules, classes etc. with ?, source
code with ??
Browser based notebook (Jupyter) with support for
(runnable) code, text, mathematical expressions using
LATEX, inline plots etc.
Could be used as a computational lab notes/worksheets
Magic functions to access the shell, run R code etc.
Parallel computing
4 / 31
 
Notes on Jupyter
1. The Jupyter Notebook works with over 40 languages
2. Jupyter Notebooks render on GitHub
Jupyter
Computational Narratives
1. Computers are optimized for producing, consuming and
processing data.
2. Humans are optimized for producing, consuming and
processing narratives/stories.
3. For code and data to be useful to humans, we need tools
for creating and sharing narratives that involve code and
data.
The Jupyter Notebook is a tool for creating and sharing
computational narratives.
5 / 31
Jupyter & Data Science
The Jupyter Notebook is a tool that allows us to explore the
fundamental questions of Data Science
with a particular dataset
with code and data
in a manner that produces a computational narrative
that can be shared, reproduced, modified, and extended.
At the end of it all, those computational narratives encapsulate
the goal or end point of Data Science. The character of the
narrative (prediction, inference, data generation, insight, etc.)
will vary from case to case.
Thepurposeofcomputingisinsight,notnumbers.
Hamming,Richard(1962).NumericalMethodsforScientistsand
6 / 31
 NumPy
7 / 31
NumPy
NumPy is the fundamental package for scientific computing with
Python. It contains among other things:
A powerful N-dimensional array object
Sophisticated (broadcasting) functions
Tools for integrating C/C++ and Fortran code
Useful linear algebra, Fourier transform, and random
number capabilities
Besides its obvious scientific uses, NumPy can also be used as
an efficient multi-dimensional container of generic data.
Arbitrary data-types can be defined. This allows NumPy to
seamlessly and speedily integrate with a wide variety of
databases.
NumPy provides a powerful N-dimensions array object
Methods on these arrays are fast because they relies on
well-optimised librairies for linear algebra (BLAS, ATLAS,
MKL)
NumPy is tolerant to python’s lists
NumPy inherits from years of computer based numerical
analysis problem solving
8 / 31
importnumpyasnp
a=np.array([1,2,3]) #Createarank1array
printtype(a) #Prints"<type'numpy.ndarray'>"
printa.shape #Prints"(3,)"
printa[0],a[1],a[2] #Prints"123"
a[0]=5 #Changeanelementofthearray
printa #Prints"[5,2,3]"
b=np.array([[1,2,3],[4,5,6]]) #Createarank2array
printb.shape #Prints"(2,3)"
printb[0,0],b[0,1],b[1,0] #Prints"124"
#-----
a=np.zeros((2,2)) #Createanarrayofallzeros
printa #Prints"[[0. 0.]
# [0. 0.]]"
b=np.ones((1,2)) #Createanarrayofallones
printb #Prints"[[1. 1.]]"
c=np.full((2,2),7)#Createaconstantarray
printc #Prints"[[7. 7.]
# [7. 7.]]"
d=np.eye(2) #Createa2x2identitymatrix
printd #Prints"[[1. 0.]
# [0. 1.]]"
e=np.random.random((2,2))#Createanarrayfilledwithrandomvalues
printe #Mightprint"[[0.91940167 0.08143941]
# [0.68744134 0.87236687]]"
Numpy
Numpy is the core library for scientific computing in Python. It
provides a high-performance multidimensional array object
(MATLAB style), and tools for working with these arrays.
Arrays
A numpy array is a grid of values, all of the same type, and
is indexed by a tuple of nonnegative integers.
The number of dimensions is the rank of the array; the
shape of an array is a tuple of integers giving the size of
the array along each dimension.
We can initialize numpy arrays from nested Python lists,
and access elements using square brackets.
Numpy also provides many functions to create arrays.
9 / 31
 SciPy
10 / 31
SciPy
SciPy is a Python-based ecosystem of open-source software for
mathematics, science, and engineering. SciPy core packages:
IPython, NumPy, SciPy Library, SimPy, matplotlib, pandas.
SciPy Library
SciPy is a collection of mathematical algorithms and convenience
functions built on top of NumPy includes modules for: statistics,
integration & ODE solvers, linear algebra, optimization, FFT, etc.
We use the terms SciPy and SciPy Library interchangeably.
Meaning depends on context.
SciPy is a toolbox for researchers/scientists, it contains many
hidden treasures for them.
11 / 31
SciPy & NumPy
Numpy provides a high-performance multidimensional array
and basic tools to compute with and manipulate these arrays.
SciPy builds on this, and provides a large number of functions
that operate on numpy arrays and are useful for different types
of scientific and engineering applications.
SciPy provides numerous numerical routines, that run efficiently
on top of NumPy arrays for: optimization, signal processing,
linear algebra and many more. It also provides some convenient
data structures as compressed sparse matrix and spatial data
structures. If you had already use some scikits (scikit-learn,
scikit-image) you already used scipy extensively.
A few thoughts on SciPy:
Contains linear algebra routines that overlap with NumPy;
SciPy’s linear algebra routines always run on the
optimized system libraries (LAPACK, ATLAS, Intel Math
Kernel Library, etc.)
Sparse matrix support
Extends NumPy’s statistical capabilities
Under active development, new toys added constantly!
12 / 31
SciPy
A big box of tools:
Special functions (scipy.special)
Integration (scipy.integrate)
Optimization (scipy.optimize)
Interpolation (scipy.interpolate)
Fourier Transforms (scipy.fftpack)
Signal Processing (scipy.signal)
Statistics (scipy.stats)
Linear Algebra (scipy.linalg)
File IO (scipy.io)
Sparse Eigenvalue Problems with ARPACK
Compressed Sparse Graph Routines
(scipy.sparse.csgraph)
Spatial data structures and algorithms (scipy.spatial)
Multi-dimensional image processing (scipy.ndimage)
Weave (scipy.weave)
fromscipy.statsimportlinregress
(slope,intercept,r,p,se)=linregress(x,noisy_y)
#---
fromscipy.statsimportspearmanr,pearsonr
x_cubed=x**3
x_cubed+=np.random.normal(0,3,10)
13 / 31
 matplotlib
14 / 31
matplotlib
The ultimate plotting library that renders 2D and 3D high-quality
plots for python.
pyplot implements Matlab-style plotting
Object-oriented API for more advanced graphics
The API mimics, in many ways the MATLAB one, easing the
transition from MATLAB users to python
Once again, no surprises, matplotlib is a very stable and
mature project (expect one major release per year)
Inline plots in the notebook:
ipythonnotebook--pylabinline
15 / 31
importnumpyasnp
importmatplotlib.pyplotasplt
#Computethexandycoordinatesforpointsonasinecurve
x=np.arange(0,3*np.pi,0.1)
y=np.sin(x)
#Plotthepointsusingmatplotlib
plt.plot(x,y)
plt.show() #Youmustcallplt.show()tomakegraphicsappear.
importnumpyasnp
importmatplotlib.pyplotasplt
#Computethexandycoordinatesforpointsonsineandcosinecurves
x=np.arange(0,3*np.pi,0.1)
y_sin=np.sin(x)
y_cos=np.cos(x)
#Plotthepointsusingmatplotlib
plt.plot(x,y_sin)
plt.plot(x,y_cos)
plt.xlabel('xaxislabel')
plt.ylabel('yaxislabel')
plt.title('SineandCosine')
plt.legend(['Sine','Cosine'])
plt.show()
matplotlib
matplotlib tries to make easy things easy and hard things
possible. You can generate plots, histograms, power spectra,
bar charts, errorcharts, scatterplots, etc, with just a few lines of
code.
For simple plotting the pyplot interface provides a MATLAB-like
interface, particularly when combined with IPython. For the
power user, you have full control of line styles, font properties,
axes properties, etc, via an object oriented interface or via a set
of functions familiar to MATLAB users.
With just a little bit of extra work we can easily plot a more
complex chart e.g. multiple lines at once, and add a title,
legend, and axis labels.
16 / 31
 Notes
17 / 31
TL;DR
NumPy is the foundation
SciPy is built upon NumPy, with some overlapping
functionality
matplotlib complements both
NumPy, SciPy, matplotlib
NumPy is the foundation of scientific and numerical
computing with Python
SciPy is a collection of mathematical and scientific tools
matplotlib is a technical plotting package
NumPy Arrays
Implemented in C for efficiency
Python indexing and slicing
Elements are strongly typed
Taking advantage of NumPy
Think in parallel!
Replace loops with vector operations
matplotlib
Primarily 2D plotting
Basic 3D plots available with mplot3d (import
mpl_toolkits.mplot3d)
18 / 31
Other Notes
NumPy/SciPy/scikit-learn rely on many low-level Fortran/C
library such as BLAS, ATLAS, the Intel MKL…
most of these libraries are shipped by your favorite OS
unoptimized (well, maybe not the case for Mac)
you may want to re-compile these libraries or to use a
packaged python distribution (anaconda, canopy)
libraries for performance: numba, cython, ...
19 / 31
 pandas
20 / 31
pandas is an open source, BSD-licensed library providing high-
performance, easy-to-use data structures and data analysis tools
for the Python programming language.
pandas
"R for Python"
Provides easy to use data structures & a ton of useful
helper functions for data cleanup and transformations
Fast! (backed by NumPy arrays)
Integrates well with other libs e.g. scikit-learn
21 / 31
importpandasaspd
importnumpyasnp
importmatplotlib.pyplotasplt
s=pd.Series([1,3,5,np.nan,6,8])
dates=pd.date_range('20130101',periods=6)
df=pd.DataFrame(np.random.randn(6,4),index=dates,columns=list(
df2=pd.DataFrame({'A':1.,
'B':pd.Timestamp('20130102'),
'C':pd.Series(1,index=list(range(4)),dtype=
'D':np.array([3]*4,dtype='int32'),
'E':pd.Categorical(["test","train","test"
'F':'foo'})
pandas
pandas provides the DataFrameclass, which is very
similar to a data.framein R
Built on top of NumPy arrays, and allows mixed column
types
Copes well with missing values (unlike NumPy)
Intelligently matches on columns/indices (supports SQL-
like joins etc.)
Read and write .csv, .xls, HTML tables etc.
Lots of useful data analysis tools built in
22 / 31
 SymPy
23 / 31
SymPy
SymPy is a Python library for symbolic mathematics. It aims to
become a full-featured computer algebra system (CAS) while
keeping the code as simple as possible in order to be
comprehensible and easily extensible.
SymPy is written entirely in Python and does not require any
external libraries.
importsympy
sympy.sqrt(8)
#2*sqrt(2)
fromsympyimportsymbols
x,y=symbols('xy')
expr=x+2*y
expr
#x+2*y
expr-x
#2*y
24 / 31
 scikit-learn
25 / 31
scikit-learn
Machine Learning algorithms implemented in Python on
top of NumPy & SciPy
Conveniently maintains the same interface to a wide
range of algorithms
Includes algorithms for: Classification, Regression,
Clustering, Dimensionality reduction
As well as lots of useful utilities (cross-validation,
preprocessing etc.)
fromsklearnimportdatasets
iris=datasets.load_iris()
digits=datasets.load_digits()
print(digits.data)
digits.target
digits.images[0]
fromsklearnimportsvm
clf=svm.SVC(gamma=0.001,C=100.)
clf.fit(digits.data[:-1],digits.target[:-1])
26 / 31
 The State of the Stack
27 / 31
28 / 31
Many More Tools ..
Performance
Numba, Weave, Numexpr, Theano . . .
Visualization
Bokeh, Seaborn, Plotly, Chaco, mpld3, ggplot, MayaVi, vincent, toyplot, HoloViews . . .
Data Structures & Computation
Blaze, Dask, DistArray, XRay, Graphlab, SciDBpy, pySpark . . .
Packaging & distribution:
pip/wheels, conda, EPD, Canopy, Anaconda ...
29 / 31
References
1. Brian Granger: Project Jupyter as a Foundation for Open Data Science
2. Juan Luis Cano Rodriguez, IPython: How a notebook is changing science | Python as a real alternative to
MATLAB, Mathematica and other commercial software
3. Olivier Hervieu: Introduction to scientific programming in python
4. CS231n: IPython Tutorial, http://cs231n.github.io/ipython-tutorial/
5. J.R. Johansson: Introduction to scientific computing with Python
6. Introduction to solving biological problems with Python by pycam
7. Jake VanderPlas: The State of the Stack
30 / 31

END
Eueung Mulyana
http://eueung.github.io/python/sci
Hint: Navigate with Arrow Keys | Attribution-ShareAlike CC BY-SA
31 / 31

Mais conteúdo relacionado

Mais procurados

Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Fariz Darari
 
Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaEdureka!
 
The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPykammeyer
 
A peek on numerical programming in perl and python e christopher dyken 2005
A peek on numerical programming in perl and python  e christopher dyken  2005A peek on numerical programming in perl and python  e christopher dyken  2005
A peek on numerical programming in perl and python e christopher dyken 2005Jules Krdenas
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 
SunPy: Python for solar physics
SunPy: Python for solar physicsSunPy: Python for solar physics
SunPy: Python for solar physicssegfaulthunter
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with PythonSushant Mane
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...Maulik Borsaniya
 
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...Everything You Always Wanted to Know About Memory in Python But Were Afraid t...
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...Piotr Przymus
 
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Piotr Przymus
 

Mais procurados (20)

Python
PythonPython
Python
 
Python basics
Python basicsPython basics
Python basics
 
Python Basics
Python Basics Python Basics
Python Basics
 
Python Basics
Python BasicsPython Basics
Python Basics
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
Python basic
Python basicPython basic
Python basic
 
Python NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | EdurekaPython NumPy Tutorial | NumPy Array | Edureka
Python NumPy Tutorial | NumPy Array | Edureka
 
python.ppt
python.pptpython.ppt
python.ppt
 
The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPy
 
A peek on numerical programming in perl and python e christopher dyken 2005
A peek on numerical programming in perl and python  e christopher dyken  2005A peek on numerical programming in perl and python  e christopher dyken  2005
A peek on numerical programming in perl and python e christopher dyken 2005
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
SunPy: Python for solar physics
SunPy: Python for solar physicsSunPy: Python for solar physics
SunPy: Python for solar physics
 
Python ppt
Python pptPython ppt
Python ppt
 
Using Parallel Computing Platform - NHDNUG
Using Parallel Computing Platform - NHDNUGUsing Parallel Computing Platform - NHDNUG
Using Parallel Computing Platform - NHDNUG
 
Python ppt
Python pptPython ppt
Python ppt
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with Python
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
 
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...Everything You Always Wanted to Know About Memory in Python But Were Afraid t...
Everything You Always Wanted to Know About Memory in Python But Were Afraid t...
 
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
 

Semelhante a Scientific Python

Python-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxPython-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxanushya2915
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologiesPolad Saruxanov
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPyDevashish Kumar
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationTravis Oliphant
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysisPramod Toraskar
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Fwdays
 
Python for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive GuidePython for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive Guidepriyanka rajput
 
Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataTravis Oliphant
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxAdarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxhkabir55
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on pythonShubham Yadav
 

Semelhante a Scientific Python (20)

Python-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptxPython-Libraries,Numpy,Pandas,Matplotlib.pptx
Python-Libraries,Numpy,Pandas,Matplotlib.pptx
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
 
Sci computing using python
Sci computing using pythonSci computing using python
Sci computing using python
 
Session 2
Session 2Session 2
Session 2
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
 
Large Data Analyze With PyTables
Large Data Analyze With PyTablesLarge Data Analyze With PyTables
Large Data Analyze With PyTables
 
PyTables
PyTablesPyTables
PyTables
 
Py tables
Py tablesPy tables
Py tables
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft Presentation
 
Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
 
Python Científico
Python CientíficoPython Científico
Python Científico
 
PyCon Estonia 2019
PyCon Estonia 2019PyCon Estonia 2019
PyCon Estonia 2019
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Python for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive GuidePython for Data Science: A Comprehensive Guide
Python for Data Science: A Comprehensive Guide
 
PyTables
PyTablesPyTables
PyTables
 
Scale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyDataScale up and Scale Out Anaconda and PyData
Scale up and Scale Out Anaconda and PyData
 
Adarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptxAdarsh_Masekar(2GP19CS003).pptx
Adarsh_Masekar(2GP19CS003).pptx
 
Python libraries
Python librariesPython libraries
Python libraries
 
summer training report on python
summer training report on pythonsummer training report on python
summer training report on python
 
DS LAB MANUAL.pdf
DS LAB MANUAL.pdfDS LAB MANUAL.pdf
DS LAB MANUAL.pdf
 

Mais de Eueung Mulyana

Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveEueung Mulyana
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldEueung Mulyana
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain IntroductionEueung Mulyana
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachEueung Mulyana
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionEueung Mulyana
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking OverviewEueung Mulyana
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments Eueung Mulyana
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorialEueung Mulyana
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionEueung Mulyana
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionEueung Mulyana
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesEueung Mulyana
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuatorsEueung Mulyana
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5GEueung Mulyana
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Eueung Mulyana
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseEueung Mulyana
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud ComputingEueung Mulyana
 

Mais de Eueung Mulyana (20)

FGD Big Data
FGD Big DataFGD Big Data
FGD Big Data
 
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem PerspectiveHyper-Connectivity and Data Proliferation - Ecosystem Perspective
Hyper-Connectivity and Data Proliferation - Ecosystem Perspective
 
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated WorldIndustry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
Industry 4.0 And Beyond The A.I* For Surviving A Tech-Accelerated World
 
Blockchain Introduction
Blockchain IntroductionBlockchain Introduction
Blockchain Introduction
 
Bringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based ApproachBringing Automation to the Classroom: A ChatOps-Based Approach
Bringing Automation to the Classroom: A ChatOps-Based Approach
 
FinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency IntroductionFinTech & Cryptocurrency Introduction
FinTech & Cryptocurrency Introduction
 
Open Source Networking Overview
Open Source Networking OverviewOpen Source Networking Overview
Open Source Networking Overview
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Open stack pike-devstack-tutorial
Open stack pike-devstack-tutorialOpen stack pike-devstack-tutorial
Open stack pike-devstack-tutorial
 
Basic onos-tutorial
Basic onos-tutorialBasic onos-tutorial
Basic onos-tutorial
 
ONOS SDN Controller - Introduction
ONOS SDN Controller - IntroductionONOS SDN Controller - Introduction
ONOS SDN Controller - Introduction
 
OpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - IntroductionOpenDaylight SDN Controller - Introduction
OpenDaylight SDN Controller - Introduction
 
Mininet Basics
Mininet BasicsMininet Basics
Mininet Basics
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Cloud Computing: Overview and Examples
Cloud Computing: Overview and ExamplesCloud Computing: Overview and Examples
Cloud Computing: Overview and Examples
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Connected Things, IoT and 5G
Connected Things, IoT and 5GConnected Things, IoT and 5G
Connected Things, IoT and 5G
 
Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+Connectivity for Local Sensors and Actuators Using nRF24L01+
Connectivity for Local Sensors and Actuators Using nRF24L01+
 
NodeMCU with Blynk and Firebase
NodeMCU with Blynk and FirebaseNodeMCU with Blynk and Firebase
NodeMCU with Blynk and Firebase
 
Trends and Enablers - Connected Services and Cloud Computing
Trends and Enablers  - Connected Services and Cloud ComputingTrends and Enablers  - Connected Services and Cloud Computing
Trends and Enablers - Connected Services and Cloud Computing
 

Último

APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoilmeghakumariji156
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...kumargunjan9515
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理F
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样ayvbos
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...meghakumariji156
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiMonica Sydney
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 

Último (20)

call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...Local Call Girls in Seoni  9332606886 HOT & SEXY Models beautiful and charmin...
Local Call Girls in Seoni 9332606886 HOT & SEXY Models beautiful and charmin...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理一比一原版田纳西大学毕业证如何办理
一比一原版田纳西大学毕业证如何办理
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu DhabiAbu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
Abu Dhabi Escorts Service 0508644382 Escorts in Abu Dhabi
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 

Scientific Python

  • 1.  Scientific Python Eueung Mulyana http://eueung.github.io/python/sci Hint: Navigate with Arrow Keys | Attribution-ShareAlike CC BY-SA 1 / 31
  • 2. Agenda 1. Jupyter / IPython 2. NumPy 3. SciPy 4. matplotlib 5. pandas 6. SymPy 7. scikit-learn 8. jakevdp: The State of the Stack 2 / 31
  • 3.  Jupyter / IPython 3 / 31
  • 4. IPython Powerful interactive shell Supports tab completion of just about everything Inline help system for modules, classes etc. with ?, source code with ?? Browser based notebook (Jupyter) with support for (runnable) code, text, mathematical expressions using LATEX, inline plots etc. Could be used as a computational lab notes/worksheets Magic functions to access the shell, run R code etc. Parallel computing 4 / 31
  • 5.   Notes on Jupyter 1. The Jupyter Notebook works with over 40 languages 2. Jupyter Notebooks render on GitHub Jupyter Computational Narratives 1. Computers are optimized for producing, consuming and processing data. 2. Humans are optimized for producing, consuming and processing narratives/stories. 3. For code and data to be useful to humans, we need tools for creating and sharing narratives that involve code and data. The Jupyter Notebook is a tool for creating and sharing computational narratives. 5 / 31
  • 6. Jupyter & Data Science The Jupyter Notebook is a tool that allows us to explore the fundamental questions of Data Science with a particular dataset with code and data in a manner that produces a computational narrative that can be shared, reproduced, modified, and extended. At the end of it all, those computational narratives encapsulate the goal or end point of Data Science. The character of the narrative (prediction, inference, data generation, insight, etc.) will vary from case to case. Thepurposeofcomputingisinsight,notnumbers. Hamming,Richard(1962).NumericalMethodsforScientistsand 6 / 31
  • 8. NumPy NumPy is the fundamental package for scientific computing with Python. It contains among other things: A powerful N-dimensional array object Sophisticated (broadcasting) functions Tools for integrating C/C++ and Fortran code Useful linear algebra, Fourier transform, and random number capabilities Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases. NumPy provides a powerful N-dimensions array object Methods on these arrays are fast because they relies on well-optimised librairies for linear algebra (BLAS, ATLAS, MKL) NumPy is tolerant to python’s lists NumPy inherits from years of computer based numerical analysis problem solving 8 / 31
  • 9. importnumpyasnp a=np.array([1,2,3]) #Createarank1array printtype(a) #Prints"<type'numpy.ndarray'>" printa.shape #Prints"(3,)" printa[0],a[1],a[2] #Prints"123" a[0]=5 #Changeanelementofthearray printa #Prints"[5,2,3]" b=np.array([[1,2,3],[4,5,6]]) #Createarank2array printb.shape #Prints"(2,3)" printb[0,0],b[0,1],b[1,0] #Prints"124" #----- a=np.zeros((2,2)) #Createanarrayofallzeros printa #Prints"[[0. 0.] # [0. 0.]]" b=np.ones((1,2)) #Createanarrayofallones printb #Prints"[[1. 1.]]" c=np.full((2,2),7)#Createaconstantarray printc #Prints"[[7. 7.] # [7. 7.]]" d=np.eye(2) #Createa2x2identitymatrix printd #Prints"[[1. 0.] # [0. 1.]]" e=np.random.random((2,2))#Createanarrayfilledwithrandomvalues printe #Mightprint"[[0.91940167 0.08143941] # [0.68744134 0.87236687]]" Numpy Numpy is the core library for scientific computing in Python. It provides a high-performance multidimensional array object (MATLAB style), and tools for working with these arrays. Arrays A numpy array is a grid of values, all of the same type, and is indexed by a tuple of nonnegative integers. The number of dimensions is the rank of the array; the shape of an array is a tuple of integers giving the size of the array along each dimension. We can initialize numpy arrays from nested Python lists, and access elements using square brackets. Numpy also provides many functions to create arrays. 9 / 31
  • 11. SciPy SciPy is a Python-based ecosystem of open-source software for mathematics, science, and engineering. SciPy core packages: IPython, NumPy, SciPy Library, SimPy, matplotlib, pandas. SciPy Library SciPy is a collection of mathematical algorithms and convenience functions built on top of NumPy includes modules for: statistics, integration & ODE solvers, linear algebra, optimization, FFT, etc. We use the terms SciPy and SciPy Library interchangeably. Meaning depends on context. SciPy is a toolbox for researchers/scientists, it contains many hidden treasures for them. 11 / 31
  • 12. SciPy & NumPy Numpy provides a high-performance multidimensional array and basic tools to compute with and manipulate these arrays. SciPy builds on this, and provides a large number of functions that operate on numpy arrays and are useful for different types of scientific and engineering applications. SciPy provides numerous numerical routines, that run efficiently on top of NumPy arrays for: optimization, signal processing, linear algebra and many more. It also provides some convenient data structures as compressed sparse matrix and spatial data structures. If you had already use some scikits (scikit-learn, scikit-image) you already used scipy extensively. A few thoughts on SciPy: Contains linear algebra routines that overlap with NumPy; SciPy’s linear algebra routines always run on the optimized system libraries (LAPACK, ATLAS, Intel Math Kernel Library, etc.) Sparse matrix support Extends NumPy’s statistical capabilities Under active development, new toys added constantly! 12 / 31
  • 13. SciPy A big box of tools: Special functions (scipy.special) Integration (scipy.integrate) Optimization (scipy.optimize) Interpolation (scipy.interpolate) Fourier Transforms (scipy.fftpack) Signal Processing (scipy.signal) Statistics (scipy.stats) Linear Algebra (scipy.linalg) File IO (scipy.io) Sparse Eigenvalue Problems with ARPACK Compressed Sparse Graph Routines (scipy.sparse.csgraph) Spatial data structures and algorithms (scipy.spatial) Multi-dimensional image processing (scipy.ndimage) Weave (scipy.weave) fromscipy.statsimportlinregress (slope,intercept,r,p,se)=linregress(x,noisy_y) #--- fromscipy.statsimportspearmanr,pearsonr x_cubed=x**3 x_cubed+=np.random.normal(0,3,10) 13 / 31
  • 15. matplotlib The ultimate plotting library that renders 2D and 3D high-quality plots for python. pyplot implements Matlab-style plotting Object-oriented API for more advanced graphics The API mimics, in many ways the MATLAB one, easing the transition from MATLAB users to python Once again, no surprises, matplotlib is a very stable and mature project (expect one major release per year) Inline plots in the notebook: ipythonnotebook--pylabinline 15 / 31
  • 16. importnumpyasnp importmatplotlib.pyplotasplt #Computethexandycoordinatesforpointsonasinecurve x=np.arange(0,3*np.pi,0.1) y=np.sin(x) #Plotthepointsusingmatplotlib plt.plot(x,y) plt.show() #Youmustcallplt.show()tomakegraphicsappear. importnumpyasnp importmatplotlib.pyplotasplt #Computethexandycoordinatesforpointsonsineandcosinecurves x=np.arange(0,3*np.pi,0.1) y_sin=np.sin(x) y_cos=np.cos(x) #Plotthepointsusingmatplotlib plt.plot(x,y_sin) plt.plot(x,y_cos) plt.xlabel('xaxislabel') plt.ylabel('yaxislabel') plt.title('SineandCosine') plt.legend(['Sine','Cosine']) plt.show() matplotlib matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. For simple plotting the pyplot interface provides a MATLAB-like interface, particularly when combined with IPython. For the power user, you have full control of line styles, font properties, axes properties, etc, via an object oriented interface or via a set of functions familiar to MATLAB users. With just a little bit of extra work we can easily plot a more complex chart e.g. multiple lines at once, and add a title, legend, and axis labels. 16 / 31
  • 18. TL;DR NumPy is the foundation SciPy is built upon NumPy, with some overlapping functionality matplotlib complements both NumPy, SciPy, matplotlib NumPy is the foundation of scientific and numerical computing with Python SciPy is a collection of mathematical and scientific tools matplotlib is a technical plotting package NumPy Arrays Implemented in C for efficiency Python indexing and slicing Elements are strongly typed Taking advantage of NumPy Think in parallel! Replace loops with vector operations matplotlib Primarily 2D plotting Basic 3D plots available with mplot3d (import mpl_toolkits.mplot3d) 18 / 31
  • 19. Other Notes NumPy/SciPy/scikit-learn rely on many low-level Fortran/C library such as BLAS, ATLAS, the Intel MKL… most of these libraries are shipped by your favorite OS unoptimized (well, maybe not the case for Mac) you may want to re-compile these libraries or to use a packaged python distribution (anaconda, canopy) libraries for performance: numba, cython, ... 19 / 31
  • 21. pandas is an open source, BSD-licensed library providing high- performance, easy-to-use data structures and data analysis tools for the Python programming language. pandas "R for Python" Provides easy to use data structures & a ton of useful helper functions for data cleanup and transformations Fast! (backed by NumPy arrays) Integrates well with other libs e.g. scikit-learn 21 / 31
  • 22. importpandasaspd importnumpyasnp importmatplotlib.pyplotasplt s=pd.Series([1,3,5,np.nan,6,8]) dates=pd.date_range('20130101',periods=6) df=pd.DataFrame(np.random.randn(6,4),index=dates,columns=list( df2=pd.DataFrame({'A':1., 'B':pd.Timestamp('20130102'), 'C':pd.Series(1,index=list(range(4)),dtype= 'D':np.array([3]*4,dtype='int32'), 'E':pd.Categorical(["test","train","test" 'F':'foo'}) pandas pandas provides the DataFrameclass, which is very similar to a data.framein R Built on top of NumPy arrays, and allows mixed column types Copes well with missing values (unlike NumPy) Intelligently matches on columns/indices (supports SQL- like joins etc.) Read and write .csv, .xls, HTML tables etc. Lots of useful data analysis tools built in 22 / 31
  • 24. SymPy SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries. importsympy sympy.sqrt(8) #2*sqrt(2) fromsympyimportsymbols x,y=symbols('xy') expr=x+2*y expr #x+2*y expr-x #2*y 24 / 31
  • 26. scikit-learn Machine Learning algorithms implemented in Python on top of NumPy & SciPy Conveniently maintains the same interface to a wide range of algorithms Includes algorithms for: Classification, Regression, Clustering, Dimensionality reduction As well as lots of useful utilities (cross-validation, preprocessing etc.) fromsklearnimportdatasets iris=datasets.load_iris() digits=datasets.load_digits() print(digits.data) digits.target digits.images[0] fromsklearnimportsvm clf=svm.SVC(gamma=0.001,C=100.) clf.fit(digits.data[:-1],digits.target[:-1]) 26 / 31
  • 27.  The State of the Stack 27 / 31
  • 29. Many More Tools .. Performance Numba, Weave, Numexpr, Theano . . . Visualization Bokeh, Seaborn, Plotly, Chaco, mpld3, ggplot, MayaVi, vincent, toyplot, HoloViews . . . Data Structures & Computation Blaze, Dask, DistArray, XRay, Graphlab, SciDBpy, pySpark . . . Packaging & distribution: pip/wheels, conda, EPD, Canopy, Anaconda ... 29 / 31
  • 30. References 1. Brian Granger: Project Jupyter as a Foundation for Open Data Science 2. Juan Luis Cano Rodriguez, IPython: How a notebook is changing science | Python as a real alternative to MATLAB, Mathematica and other commercial software 3. Olivier Hervieu: Introduction to scientific programming in python 4. CS231n: IPython Tutorial, http://cs231n.github.io/ipython-tutorial/ 5. J.R. Johansson: Introduction to scientific computing with Python 6. Introduction to solving biological problems with Python by pycam 7. Jake VanderPlas: The State of the Stack 30 / 31
  • 31.  END Eueung Mulyana http://eueung.github.io/python/sci Hint: Navigate with Arrow Keys | Attribution-ShareAlike CC BY-SA 31 / 31