万本电子书0元读

万本电子书0元读

顶部广告

NumPy Beginner's Guide - Second Edition电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:Ivan Idris

出  版  社:Packt Publishing

出版时间:2013-04-25

字       数:69.9万

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

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

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
The book is written in beginner’s guide style with each aspect of NumPy demonstrated with real world examples and required screenshots. If you are a programmer, scientist, or engineer who has basic Python knowledge and would like to be able to do numerical computations with Python, this book is for you. No prior knowledge of NumPy is required.
目录展开

NumPy Beginner's Guide Second Edition

Table of Contents

Numpy Beginner's Guide Second 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

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. NumPy Quick Start

Python

Time for action – installing Python on different operating systems

What just happened?

Windows

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

What just happened?

Linux

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

What just happened?

Mac OS X

Time for action – installing NumPy, Matplotlib, and SciPy on Mac OS X

What just happened?

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 matrix

Selecting elements

NumPy numerical types

Data type objects

Character codes

dtype constructors

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. Get in Terms with Commonly Used Functions

File I/O

Time for action – reading and writing files

What just happened?

CSV files

Time for action – loading from CSV files

What just happened?

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 – doing 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

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?

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

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 function

What just happened?

Universal function methods

Time for action – applying the ufunc methods on add

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?

Summary

6. Move 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?

Pseudoinverse

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?

Summary

7. Peeking into Special Routines

Sorting

Time for action – sorting lexically

What just happened?

Have a go hero – trying a different sort order

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 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. Assure 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 array 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?

Objects 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 tests 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 derivative

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 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 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

Samples’ 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?

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

Chapter 2, Beginning with NumPy Fundamentals

Chapter 3, Get into Terms with Commonly Used Functions

Chapter 4, Convenience functions for your convenience

Chapter 5, Working with Matrices and ufuncs

Chapter 6, Move further with NumPy modules

Chapter 7, Peeking into special routines

Chapter 8, Assure Quality with Testing

Chapter 9, Plotting with Matplotlib

Chapter 10, When NumPy is not enough Scipy and beyond

Index

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

发表评论

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

买过这本书的人还买过

读了这本书的人还在读

回顶部