万本电子书0元读

万本电子书0元读

顶部广告

NumPy: Beginner's Guide - Third Edition电子书

售       价:¥

22人正在读 | 0人评论 9.8

作       者:Ivan Idris

出  版  社:Packt Publishing

出版时间:2015-06-24

字       数:80.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This book is for the scientists, engineers, programmers, or analysts looking for a high-quality, open source mathematical library. Knowledge of Python is assumed. Also, some affinity, or at least interest, in mathematics and statistics is required. However, I have provided brief explanations and pointers to learning resources.
目录展开

NumPy Beginner's Guide Third Edition

Table of Contents

NumPy Beginner's Guide Third Edition

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What is NumPy?

History

Why use NumPy?

Limitations of NumPy

What this book covers

What you need for this book

Who this book is for

Sections

Time for action – heading

What just happened?

Pop quiz – heading

Have a go hero – heading

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

1. NumPy Quick Start

Python

Time for action – installing Python on different operating systems

What just happened?

The Python help system

Time for action – using the Python help system

What just happened?

Basic arithmetic and variable assignment

Time for action – using Python as a calculator

What just happened?

Time for action – assigning values to variables

What just happened?

The print() function

Time for action – printing with the print() function

What just happened?

Code comments

Time for action – commenting code

The if statement

Time for action – deciding with the if statement

What just happened?

The for loop

Time for action – repeating instructions with loops

What just happened?

Python functions

Time for action – defining functions

What just happened?

Python modules

Time for action – importing modules

What just happened?

NumPy on Windows

Time for action – installing NumPy, matplotlib, SciPy, and IPython on Windows

What just happened?

NumPy on Linux

Time for action – installing NumPy, matplotlib, SciPy, and IPython on Linux

NumPy on Mac OS X

Time for action – installing NumPy, SciPy, matplotlib, and IPython with MacPorts or Fink

What just happened?

Building from source

Arrays

Time for action – adding vectors

What just happened?

Pop quiz – Functioning of the arange() function

Have a go hero – continue the analysis

IPython – an interactive shell

Online resources and help

Summary

2. Beginning with NumPy Fundamentals

NumPy array object

Time for action – creating a multidimensional array

What just happened?

Pop quiz – the shape of ndarray

Have a go hero – create a three-by-three array

Selecting elements

NumPy numerical types

Data type objects

Character codes

The dtype constructors

The dtype attributes

Time for action – creating a record data type

What just happened?

One-dimensional slicing and indexing

Time for action – slicing and indexing multidimensional arrays

What just happened?

Time for action – manipulating array shapes

What just happened?

Stacking

Time for action – stacking arrays

What just happened?

Splitting

Time for action – splitting arrays

What just happened?

Array attributes

Time for action – converting arrays

What just happened?

Summary

3. Getting Familiar with Commonly Used Functions

File I/O

Time for action – reading and writing files

What just happened?

Comma-seperated value files

Time for action – loading from CSV files

Volume Weighted Average Price

Time for action – calculating Volume Weighted Average Price

What just happened?

The mean() function

Time-weighted average price

Pop quiz – computing the weighted average

Have a go hero – calculating other averages

Value range

Time for action – finding highest and lowest values

What just happened?

Statistics

Time for action – performing simple statistics

What just happened?

Stock returns

Time for action – analyzing stock returns

What just happened?

Dates

Time for action – dealing with dates

What just happened?

Have a go hero – looking at VWAP and TWAP

Time for action – using the datetime64 data type

What just happened?

Weekly summary

Time for action – summarizing data

What just happened?

Have a go hero – improving the code

Average True Range

Time for action – calculating the Average True Range

What just happened?

Have a go hero – taking the minimum() function for a spin

Simple Moving Average

Time for action – computing the Simple Moving Average

What just happened?

Exponential Moving Average

Time for action – calculating the Exponential Moving Average

What just happened?

Bollinger Bands

Time for action – enveloping with Bollinger Bands

What just happened?

Have a go hero – switching to Exponential Moving Average

Linear model

Time for action – predicting price with a linear model

What just happened?

Trend lines

Time for action – drawing trend lines

What just happened?

Methods of ndarray

Time for action – clipping and compressing arrays

What just happened?

Factorial

Time for action – calculating the factorial

What just happened?

Missing values and Jackknife resampling

Time for action – handling NaNs with the nanmean(), nanvar(), and nanstd() functions

What just happened?

Summary

4. Convenience Functions for Your Convenience

Correlation

Time for action – trading correlated pairs

What just happened?

Pop quiz – calculating covariance

Polynomials

Time for action – fitting to polynomials

What just happened?

Have a go hero – improving the fit

On-balance volume

Time for action – balancing volume

What just happened?

Simulation

Time for action – avoiding loops with vectorize()

What just happened?

Have a go hero – analyzing consecutive wins and losses

Smoothing

Time for action – smoothing with the hanning() function

What just happened?

Have a go hero – smoothing variations

Initialization

Time for action – creating value initialized arrays with the full() and full_like() functions

What just happened?

Summary

5. Working with Matrices and ufuncs

Matrices

Time for action – creating matrices

What just happened?

Creating a matrix from other matrices

Time for action – creating a matrix from other matrices

What just happened?

Pop quiz – defining a matrix with a string

Universal functions

Time for action – creating universal functions

What just happened?

Universal function methods

Time for action – applying the ufunc methods to the add function

What just happened?

Arithmetic functions

Time for action – dividing arrays

What just happened?

Have a go hero – experimenting with __future__.division

Modulo operation

Time for action – computing the modulo

What just happened?

Fibonacci numbers

Time for action – computing Fibonacci numbers

What just happened?

Have a go hero – timing the calculations

Lissajous curves

Time for action – drawing Lissajous curves

What just happened?

Square waves

Time for action – drawing a square wave

What just happened?

Have a go hero – getting rid of the loop

Sawtooth and triangle waves

Time for action – drawing sawtooth and triangle waves

What just happened?

Have a go hero – getting rid of the loop

Bitwise and comparison functions

Time for action – twiddling bits

What just happened?

Fancy indexing

Time for action – fancy indexing in-place for ufuncs with the at() method

What just happened?

Summary

6. Moving Further with NumPy Modules

Linear algebra

Time for action – inverting matrices

What just happened?

Pop quiz – creating a matrix

Have a go hero – inverting your own matrix

Solving linear systems

Time for action – solving a linear system

What just happened?

Finding eigenvalues and eigenvectors

Time for action – determining eigenvalues and eigenvectors

What just happened?

Singular value decomposition

Time for action – decomposing a matrix

What just happened?

Pseudo inverse

Time for action – computing the pseudo inverse of a matrix

What just happened?

Determinants

Time for action – calculating the determinant of a matrix

What just happened?

Fast Fourier transform

Time for action – calculating the Fourier transform

What just happened?

Shifting

Time for action – shifting frequencies

What just happened?

Random numbers

Time for action – gambling with the binomial

What just happened?

Hypergeometric distribution

Time for action – simulating a game show

What just happened?

Continuous distributions

Time for action – drawing a normal distribution

What just happened?

Lognormal distribution

Time for action – drawing the lognormal distribution

What just happened?

Bootstrapping in statistics

Time for action – sampling with numpy.random.choice()

What just happened?

Summary

7. Peeking into Special Routines

Sorting

Time for action – sorting lexically

What just happened?

Have a go hero – trying a different sort order

Time for action – partial sorting via selection for a fast median with the partition() function

What just happened?

Complex numbers

Time for action – sorting complex numbers

What just happened?

Pop quiz – generating random numbers

Searching

Time for action – using searchsorted

What just happened?

Array elements extraction

Time for action – extracting elements from an array

What just happened?

Financial functions

Time for action – determining the future value

What just happened?

Present value

Time for action – getting the present value

What just happened?

Net present value

Time for action – calculating the net present value

What just happened?

Internal rate of return

Time for action – determining the internal rate of return

What just happened?

Periodic payments

Time for action – calculating the periodic payments

What just happened?

Number of payments

Time for action – determining the number of periodic payments

What just happened?

Interest rate

Time for action – figuring out the rate

What just happened?

Window functions

Time for action – plotting the Bartlett window

What just happened?

Blackman window

Time for action – smoothing stock prices with the Blackman window

What just happened?

Hamming window

Time for action – plotting the Hamming window

What just happened?

Kaiser window

Time for action – plotting the Kaiser window

What just happened?

Special mathematical functions

Time for action – plotting the modified Bessel function

What just happened?

sinc

Time for action – plotting the sinc function

What just happened?

Summary

8. Assuring Quality with Testing

Assert functions

Time for action – asserting almost equal

What just happened?

Pop quiz – specifying decimal precision

Approximately equal arrays

Time for action – asserting approximately equal

What just happened?

Almost equal arrays

Time for action – asserting arrays almost equal

What just happened?

Have a go hero – comparing arrays with different shapes

Equal arrays

Time for action – comparing arrays

What just happened?

Ordering arrays

Time for action – checking the array order

What just happened?

Object comparison

Time for action – comparing objects

What just happened?

String comparison

Time for action – comparing strings

What just happened?

Floating-point comparisons

Time for action – comparing with assert_array_almost_equal_nulp

What just happened?

Comparison of floats with more ULPs

Time for action – comparing using maxulp of 2

What just happened?

Unit tests

Time for action – writing a unit test

What just happened?

Nose test decorators

Time for action – decorating tests

What just happened?

Docstrings

Time for action – executing doctests

What just happened?

Summary

9. Plotting with matplotlib

Simple plots

Time for action – plotting a polynomial function

What just happened?

Pop quiz – the plot() function

Plot format string

Time for action – plotting a polynomial and its derivatives

What just happened?

Subplots

Time for action – plotting a polynomial and its derivatives

What just happened?

Finance

Time for action – plotting a year's worth of stock quotes

What just happened?

Histograms

Time for action – charting stock price distributions

What just happened?

Have a go hero – drawing a bell curve

Logarithmic plots

Time for action – plotting stock volume

What just happened?

Scatter plots

Time for action – plotting price and volume returns with a scatter plot

What just happened?

Fill between

Time for action – shading plot regions based on a condition

What just happened?

Legend and annotations

Time for action – using a legend and annotations

What just happened?

Three-dimensional plots

Time for action – plotting in three dimensions

What just happened?

Contour plots

Time for action – drawing a filled contour plot

What just happened?

Animation

Time for action – animating plots

What just happened?

Summary

10. When NumPy Is Not Enough – SciPy and Beyond

MATLAB and Octave

Time for action – saving and loading a .mat file

What just happened?

Pop quiz – loading .mat files

Statistics

Time for action – analyzing random values

What just happened?

Have a go hero – improving the data generation

Sample comparison and SciKits

Time for action – comparing stock log returns

What just happened?

Signal processing

Time for action – detecting a trend in QQQ

What just happened?

Fourier analysis

Time for action – filtering a detrended signal

What just happened?

Mathematical optimization

Time for action – fitting to a sine

What just happened?

Numerical integration

Time for action – calculating the Gaussian integral

What just happened?

Have a go hero – experiment a bit more

Interpolation

Time for action – interpolating in one dimension

What just happened?

Image processing

Time for action – manipulating Lena

What just happened?

Audio processing

Time for action – replaying audio clips

What just happened?

Summary

11. Playing with Pygame

Pygame

Time for action – installing Pygame

Hello World

Time for action – creating a simple game

What just happened?

Animation

Time for action – animating objects with NumPy and Pygame

What just happened?

matplotlib

Time for Action – using matplotlib in Pygame

What just happened?

Surface pixels

Time for Action – accessing surface pixel data with NumPy

What just happened?

Artificial Intelligence

Time for Action – clustering points

What just happened?

OpenGL and Pygame

Time for Action – drawing the Sierpinski gasket

What just happened?

Simulation game with Pygame

Time for Action – simulating life

What just happened?

Summary

A. Pop Quiz Answers

Chapter 1, NumPy Quick Start

Pop quiz – functioning of the arange() function

Chapter 2, Beginning with NumPy Fundamentals

Pop quiz – the shape of ndarray

Chapter 3, Getting Familiar with Commonly Used Functions

Pop quiz – computing the weighted average

Chapter 4, Convenience Functions for Your Convenience

Pop quiz – calculating covariance

Chapter 5, Working with Matrices and ufuncs

Pop quiz – defining a matrix with a string

Chapter 6, Move Further with NumPy Modules

Pop quiz – creating a matrix

Chapter 7, Peeking into Special Routines

Pop quiz – generating random numbers

Chapter 8, Assuring Quality with Testing

Pop quiz – specifying decimal precision

Chapter 9, Plotting with matplotlib

Pop quiz – the plot() function

Chapter 10, When NumPy Is Not Enough –Scipy and Beyond

Pop quiz – loading .mat files

B. Additional Online Resources

Python

Mathematics and statistics

C. NumPy Functions' References

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部