Numpy
Programming
For Beginners
Quick Start Guide
Ray Yao
Copyright 2015 by Ray Yaos Team
All Rights Reserved
Neither part of this book nor whole of this book may be reproduced or transmitted in any form or by any means electronic , photographic or mechanical , including photocopying , recording , or by any information storage or retrieval system , without prior written permission from the author . All rights reserved !
Ray Yaos Team
About the Author: Ray Yaos Team
Certified PHP engineer by Zend , USA
Certified JAVA programmer by Sun , USA
Certified SCWCD developer by Oracle , USA
Certified A+ professional by CompTIA , USA
Certified ASP . NET expert by Microsoft , USA
Certified MCP professional by Microsoft , USA
Certified TECHNOLOGY specialist by Microsoft , USA
Certified NETWORK+ professional by CompTIA , USA
www . amazon . com/author/ray-yao
Recommended Books by Ray Yao
Advanced C++ Programming
Advanced Java Programming
Access Programming
AngularJs Programming
Asp . Net Programming
BootStrap Programming
C# Exercises
C# Programming
C++ Exercises
C++ Programming
Dart Programming
Django Programming
Erlang Programming
Go Programming
Html Css Exercises
Html Css Programming
Java Exercises
Java Programming
JavaScript Exercises
JavaScript Programming
JQuery Exercises
JQuery Programming
Jsp Servlets Programming
Kotlin Programming
Linux Command Line
Linux Exercises
Lua Programming
Matlab Programming
Mongodb Programming
MySql Programming
Node . Js Programming
Numpy Programming
Perl Programming
Php Exercises
Php MySql Programming
PowerShell Programming
Python Exercises
Python Programming
R Programming
React . Js Programming
Ruby Programming
Rust Programming
Scala Programming
Shell Scripting Programming
Swift Programming
TypeScript Programming
Visual Basic Exercises
Visual Basic Programming
Vue . Js Programming
Xml Json Programming
Preface
Numpy Programming & Exercises covers all essential Numpy knowledge . You can learn complete primary skills of Numpy fast and easily . The book includes many practical examples for beginners and includes questions and answers for the college exam , the engineer certification exam , and the job interview exam .
Prerequisite to learn Numpy
Before learning the Numpy , you should have basic knowledge of Python and the array, because Numpy works with Python and arrays .
Table of Contents
Hour 1
What is NumPy?
NumPy (Numerical Python) is an open source extension of Python Numerical computation . This tool can be used to store and process large matrices . It is much more efficient than Python's own nested list structure . It supports multiple dimensional array and matrix operations . In addition, it also provides a large number of mathematical libraries for array operations . NumPy is used for working with arrays .
NumPy's predecessor, Numeric was originally developed by Jim Hugunin and other collaborators . In 2005, they developed successfully NumPy in Numeric by combining the features of another generic library, Numarray, and adding other extensions . At last, NumPy forms a kind of open source code and is maintained and developed by many collaborators together .
Python itself has lists and arrays, but for large data processing, its structures have a number of drawbacks . Python does not support the multiple dimensional arrays and matrixes very well, therefore NumPy fills these gaps, it provides two basic objects : Ndarray and Ufunc, which are suitable for numeric calculation of such kind of data . In short, NumPy is a Python library .
What is NumPy for?
NumPy can help you study:
1 . Data science or machine learning
2 . Linear algebraic integral interpolation, special functions .
3 . Signal processing and image processing .
4 . Scientific and Engineering Computing
5 . Ordinary differential equation
6 . Provide an application program interface (API)
Prerequisite to learn NumPy
Before you learn NumPy programming, you must have the knowledge of the Python language .
Install NumPy
1 . Before installing NumPy, you need to install the latest version Python to your local computer . The Python download link is :
https : //www . python . org/
2 . Having downloaded the Python installer, you can install Python .
3 . After installing Python, please restart your computer .
4 . Test the Python . Please click :
Window System > Command Prompt > Input the following command :
C : \User\YourName>python
5 . If you can see the Python version, it means that Pathon have installed successfully .
6 . The command to install NumPy is :
C : \User\YourName>pip install numpy |
7 . Please click :
Window System > Command Prompt > Input the following command :
C : \User\YourName>pip install numpy
8 . After install NumPy, you can see :
9 . Congratulation ! NumPy has installed successfully !
Set Up Python Editor
We need to set up Python first so that it can work as a NumPy editor .
1 . Please click :
Python3 . 9 > IDLE (Python 3 . 9 64-bit) > open the Python editor .
2 . Please click :
Options > Configure IDLE > Gengeral > Open Edit Window > OK .
3 . Restart the Python/NumPy Editor .
Congratulation ! You can easily edit your NumPy program by using this editor from now on .
Import NumPy Library
Before we run the NumPy program, we need to import NumPy library .
Example 1.1
import numpy myArr = numpy . array([0, 1, 2, 3, 4, 5]) print(myArr) |
Output:
[0 1 2 3 4 5]
Explanation:
import numpy is a NumPy command, which is used to import NumPy library into the current program first .
Alias of NumPy Library
We usually use np as the alias of the NumPy library .
The syntax to define a np is as follows :