Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 157 lines (114 sloc) 5.575 kb
25952cf @kwgoodman Expand REAME and add rst extension.
authored
1 Who's larry?
2 ============
3
4 The main class of the la package is a labeled array, larry. A larry consists
5 of data and labels. The data is stored as a NumPy array and the labels as a
6 list of lists (one list per dimension).
7
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
8 Here's larry in schematic form::
9
25952cf @kwgoodman Expand REAME and add rst extension.
authored
10 date1 date2 date3
11 'AAPL' 209.19 207.87 210.11
12 y = 'IBM' 129.03 130.39 130.55
13 'DELL' 14.82 15.11 14.94
14
5f53734 @kwgoodman DOC Tweak to remove some Sphinx compile warnings.
authored
15 The larry above is stored internally as a `Numpy <http://scipy.org>`_
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
16 array and a list of lists::
17
25952cf @kwgoodman Expand REAME and add rst extension.
authored
18 y.label = [['AAPL', 'IBM', 'DELL'], [date1, date2, date3]]
19 y.x = np.array([[209.19, 207.87, 210.11],
20 [129.03, 130.39, 130.55],
21 [ 14.82, 15.11, 14.94]])
22
23 A larry can have any number of dimensions except zero. Here, for example, is
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
24 one way to create a one-dimensional larry::
25
25952cf @kwgoodman Expand REAME and add rst extension.
authored
26 >>> import la
27 >>> y = la.larry([1, 2, 3])
28
29 In the statement above the list is converted to a Numpy array and the labels
30 default to ``range(n)``, where *n* in this case is 3.
31
d1ba9c9 @kwgoodman Use moving window functions from Bottleneck.
authored
32 larry has built-in methods such as **ranking, merge, shuffle, move_sum,
25952cf @kwgoodman Expand REAME and add rst extension.
authored
33 zscore, demean, lag** as well as typical Numpy methods like **sum, max, std,
34 sign, clip**. NaNs are treated as missing data.
35
36 Alignment by label is automatic when you add (or subtract, multiply, divide)
0e28deb @kwgoodman Odds and ends in preparation of release. Details below:
authored
37 two larrys. You can also specify the join method (inner, outer, left, right)
38 for binary operations on two larrys with unaligned labels.
25952cf @kwgoodman Expand REAME and add rst extension.
authored
39
40 You can archive larrys in HDF5 format using **save** and **load** or using a
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
41 dictionary-like interface::
42
25952cf @kwgoodman Expand REAME and add rst extension.
authored
43 >>> io = la.IO('/tmp/dataset.hdf5')
44 >>> io['y'] = y # <--- save
45 >>> z = io['y'] # <--- load
46 >>> del io['y'] # <--- delete from archive
47
48 For the most part larry acts like a Numpy array. And, whenever you want,
49 you have direct access to the Numpy array that holds your data. For
50 example if you have a function, *myfunc*, that works on Numpy arrays and
51 doesn't change the shape or ordering of the array, then you can use it on a
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
52 larry, *y*, like this::
53
25952cf @kwgoodman Expand REAME and add rst extension.
authored
54 y.x = myfunc(y.x)
55
56 larry adds the convenience of labels, provides many built-in methods, and
57 let's you use your existing array functions.
58
59 License
60 =======
61
62 The ``la`` package is distributed under a Simplified BSD license. Parts of
63 NumPy, Scipy, and numpydoc, which all have BSD licenses, are included in
4572c4e @kwgoodman Added function to return Yahoo! historical quotes as a larry.
authored
64 ``la``. Parts of matplotlib are also included. See the LICENSE file, which
65 is distributed with the ``la`` package, for details.
25952cf @kwgoodman Expand REAME and add rst extension.
authored
66
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
67 Install
68 =======
69
70 Requirements:
71
72 ======================== ====================================================
dc2dc23 @kwgoodman ENH lar.nan_replace() is faster; uses bn.replace()
authored
73 la Python, NumPy 1.5.1-1.6.2, Bottleneck 0.6.0
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
74 Unit tests nose
75 ======================== ====================================================
76
77 Optional:
25952cf @kwgoodman Expand REAME and add rst extension.
authored
78
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
79 ============================= ================================================
80 Archive larrys in HDF5 h5py, HDF 1.8
81 Compile for speed boost gcc or MinGW
dc2dc23 @kwgoodman ENH lar.nan_replace() is faster; uses bn.replace()
authored
82 lar.ranking(norm='gaussian') SciPy 0.8, 0.9, 0.10
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
83 ============================= ================================================
fcbf325 @kwgoodman Moving statistics doc work and mov_min(), mov_max() bug fix.
authored
84
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
85 You can download the `latest version of la <http://pypi.python.org/pypi/la>`_
86 and `Bottleneck <http://pypi.python.org/pypi/Bottleneck>`_ from the Python
87 Package Index.
25952cf @kwgoodman Expand REAME and add rst extension.
authored
88
0ea3a97 @kwgoodman Doc work for adding Bottleneck.
authored
89 **GNU/Linux, Mac OS X et al.**
9ac878c @kwgoodman Added install instructions for Windows.
authored
90
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
91 To install ``la``::
92
25952cf @kwgoodman Expand REAME and add rst extension.
authored
93 $ python setup.py build
94 $ sudo python setup.py install
95
96 Or, if you wish to specify where ``la`` is installed, for example inside
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
97 ``/usr/local``::
98
25952cf @kwgoodman Expand REAME and add rst extension.
authored
99 $ python setup.py build
100 $ sudo python setup.py install --prefix=/usr/local
9ac878c @kwgoodman Added install instructions for Windows.
authored
101
63c9cd7 @kwgoodman DOC Update readme.
authored
102 Alternatively, you can use the makefile to install ``la`` inplace::
103
104 $ make all
105
9ac878c @kwgoodman Added install instructions for Windows.
authored
106 **Windows**
107
108 In order to (optionally) compile the C code in the ``la`` package you need a
109 Windows version of the gcc compiler. MinGW (Minimalist GNU for Windows)
110 contains gcc and has been used to successfully compile ``la`` on Windows.
111
112 Install MinGW and add it to your system path. Then install ``la`` with the
113 commands::
114
115 python setup.py build --compiler=mingw32
116 python setup.py install
117
118 **Post install**
119
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
120 After you have installed ``la``, run the suite of unit tests::
121
25952cf @kwgoodman Expand REAME and add rst extension.
authored
122 >>> import la
123 >>> la.test()
124 <snip>
7099543 @kwgoodman BUG la.cov() overwrites input array; closes #62
authored
125 Ran 3020 tests in 9.225s
25952cf @kwgoodman Expand REAME and add rst extension.
authored
126 OK
7099543 @kwgoodman BUG la.cov() overwrites input array; closes #62
authored
127 <nose.result.TextTestResult run=3020 errors=0 failures=0>
25952cf @kwgoodman Expand REAME and add rst extension.
authored
128
fdbe517 @kwgoodman Doc tweaks.
authored
129 The ``la`` package contains C extensions that speed up common alignment
130 operations such as adding two unaligned larrys. If the C extensions don't
131 compile when you build ``la`` then there's an automatic fallback to python
132 versions of the functions. To see whether you are using the C functions or the
c789961 @kwgoodman Silence most of the Sphinx "make html" warnings.
authored
133 Python functions::
134
c5342fd @kwgoodman New function la.info() gives package info.
authored
135 >>> la.info()
91fb57f @kwgoodman DOC Update version numbers in readme.
authored
136 la version 0.7.0
0e28deb @kwgoodman Odds and ends in preparation of release. Details below:
authored
137 la file /usr/local/lib/python2.6/dist-packages/la/__init__.pyc
65776ca @kwgoodman DOC readme update
authored
138 NumPy 1.6.2
139 Bottleneck 0.6.0
63c9cd7 @kwgoodman DOC Update readme.
authored
140 HDF5 archiving Available (h5py 2.0.0)
c5342fd @kwgoodman New function la.info() gives package info.
authored
141 listmap Faster C version
142 listmap_fill Faster C version
25952cf @kwgoodman Expand REAME and add rst extension.
authored
143
144 Since ``la`` can run in a pure python mode, you can use ``la`` by just saving
145 it and making sure that python can find it.
146
147 URLs
148 ====
149
150 =============== ========================================================
151 download http://pypi.python.org/pypi/la
36f82e7 @kwgoodman Doc tweak.
authored
152 docs http://berkeleyanalytics.com/la
f4e5d51 @kwgoodman Switch doc to point to github repo instead of gitorious.
authored
153 code https://github.com/kwgoodman/la
36f82e7 @kwgoodman Doc tweak.
authored
154 mailing list http://groups.google.com/group/labeled-array
0e28deb @kwgoodman Odds and ends in preparation of release. Details below:
authored
155 issue tracker https://github.com/kwgoodman/la/issues
25952cf @kwgoodman Expand REAME and add rst extension.
authored
156 =============== ========================================================
Something went wrong with that request. Please try again.