All Samples(11766) | Call(1) | Derive(0) | Import(11765)
NumPy
=====
Provides
1. An array object of arbitrary homogeneous items
2. Fast mathematical operations over arrays
3. Linear Algebra, Fourier Transforms, Random Number Generation
How to use the documentation
----------------------------
Documentation is available in two forms: docstrings provided
with the code, and a loose standing reference guide, available from
`the NumPy homepage <http://www.scipy.org>`_.
We recommend exploring the docstrings using
`IPython <http://ipython.scipy.org>`_, an advanced Python shell with
TAB-completion and introspection capabilities. See below for further
instructions.
The docstring examples assume that `numpy` has been imported as `np`::
>>> import numpy as np
Code snippets are indicated by three greater-than signs::
>>> x = 42
>>> x = x + 1
Use the built-in ``help`` function to view a function's docstring::
>>> help(np.sort)
... # doctest: +SKIP
For some objects, ``np.info(obj)`` may provide additional help. This is
particularly true if you see the line "Help on ufunc object:" at the top
of the help() page. Ufuncs are implemented in C, not Python, for speed.
The native Python help() does not know how to view their help, but our
np.info() function does.
To search for documents containing a keyword, do::
>>> np.lookfor('keyword')
... # doctest: +SKIP
General-purpose documents like a glossary and help on the basic concepts
of numpy are available under the ``doc`` sub-module::
>>> from numpy import doc
>>> help(doc)
... # doctest: +SKIP
Available subpackages
---------------------
doc
Topical documentation on broadcasting, indexing, etc.
lib
Basic functions used by several sub-packages.
random
Core Random Tools
linalg
Core Linear Algebra Tools
fft
Core FFT routines
polynomial
Polynomial tools
testing
Numpy testing tools
f2py
Fortran to Python Interface Generator.
distutils
Enhancements to distutils with support for
Fortran compilers support and more.
Utilities
---------
test
Run numpy unittests
show_config
Show numpy build configuration
dual
Overwrite certain functions with high-performance Scipy tools
matlib
Make everything matrices.
__version__
Numpy version string
Viewing documentation using IPython
-----------------------------------
Start IPython with the NumPy profile (``ipython -p numpy``), which will
import `numpy` under the alias `np`. Then, use the ``cpaste`` command to
paste examples into the shell. To see which functions are available in
`numpy`, type ``np.<TAB>`` (where ``<TAB>`` refers to the TAB key), or use
``np.*cos*?<ENTER>`` (where ``<ENTER>`` refers to the ENTER key) to narrow
down the list. To view the docstring for a function, use
``np.cos?<ENTER>`` (to view the docstring) and ``np.cos??<ENTER>`` (to view
the source code).
Copies vs. in-place operation
-----------------------------
Most of the functions in `numpy` return a copy of the array argument
(e.g., `np.sort`). In-place versions of these functions are often
available as array methods, i.e. ``x = np.array([1,2,3]); x.sort()``.
Exceptions to this rule are documented.src/m/a/matplotlib-HEAD/toolkits/basemap/examples/customticks.py matplotlib(Download)
from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter # example showing how to create custom tick labels for a cylindrical # projection.
src/m/a/matplotlib-HEAD/toolkits/basemap/examples/cubed_sphere.py matplotlib(Download)
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np # 'cubed sphere' # inscribe the sphere in a cube, then separately project each cube # face with gnomonic projection.
src/m/a/matplotlib-HEAD/toolkits/basemap/examples/contour_demo.py matplotlib(Download)
from mpl_toolkits.basemap import Basemap, shiftgrid import numpy as np import matplotlib.pyplot as plt # examples of filled contour plots on map projections. # read in data on lat/lon grid.
src/m/a/matplotlib-HEAD/toolkits/basemap/examples/ccsm_popgrid.py matplotlib(Download)
""" from matplotlib import rcParams import numpy.ma as ma import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, NetCDFFile
src/m/a/matplotlib-HEAD/toolkits/basemap/examples/barb_demo.py matplotlib(Download)
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# read in data.
file = open('fcover.dat','r')
ul=[];vl=[];pl=[]
src/m/a/matplotlib-HEAD/toolkits/basemap-0.9.6.1/examples/ccsm_popgrid.py matplotlib(Download)
import pylab as pl
from matplotlib import rcParams
try:
import numpy
rcParams['numerix'] = 'numpy'
except:
raise ImportError('this example requires numpy')
src/m/a/matplotlib-HEAD/py4science/examples/visual/shoot_t.py matplotlib(Download)
# do a wholesale import for coding convenience, this is highly discouraged in # larger codebases (but usually OK in very small demo scripts and interactive # use). import numpy as N import math from enthought.tvtk.tools import visual as V
src/m/a/matplotlib-HEAD/py4science/examples/skel/wallis_pi_skel.py matplotlib(Download)
# A few modules we need
import pylab as P
import numpy as N
# Create a list of points 'nrange' where we'll compute Wallis' formula
nrange = N.linspace(10,2000,20).astype(int)
src/m/a/matplotlib-HEAD/py4science/examples/skel/trapezoid_skel.py matplotlib(Download)
#!/usr/bin/env python
"""Simple trapezoid-rule integrator."""
import numpy as np
def trapz(x, y):
"""Simple trapezoid integrator for sequence-based innput.
src/m/a/matplotlib-HEAD/py4science/examples/skel/stock_records_skel.py matplotlib(Download)
""" import os, datetime, urllib import matplotlib.mlab as mlab # contains csv2rec import numpy as npy import pylab as p def fetch_stock(ticker):
Previous 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 Next