la 0.4 enters beta stage

2 views
Skip to first unread message

Keith Goodman

unread,
Jul 3, 2010, 7:43:36 PM7/3/10
to labele...@googlegroups.com
la 0.4dev is now feature complete. It will enter a brief beta stage
(uh, I guess rc stage). If you'd like to try it, you can download it
at http://github.com/kwgoodman/la by clicking the "Download Source"
button.

The release notes: http://github.com/kwgoodman/la/blob/master/RELEASE.rst

The focus of this release was binary operations between unaligned
larrys with user control of the join method (five available) and the
fill method. A general binary function, la.binaryop(), was added as
were the convenience functions add, subtract, multiply, divide.
Supporting functions such as la.align(), which aligns two larrys, were
also added.

A demo of la.add():

Create two larrys:

>>> from la import nan
>>> lar1 = larry([1, 2, nan], [['a', 'b', 'c']])
>>> lar2 = larry([1, nan, nan], [['a', 'b', 'dd']])

The default is an inner join (note that lar1 and lar2 have two labels in
common):

>>> la.add(lar1, lar2)
label_0
a
b
x
array([ 2., NaN])

which is the same result you get with lar1 + lar2:

>>> lar1 + lar2
label_0
a
b
x
array([ 2., NaN])

If one data element is missing in one larry but not in the other, then you
can replace the missing value with `missone` (here 0):

>>> la.add(lar1, lar2, missone=0)
label_0
a
b
x
array([ 2., 2.])

An outer join:

>>> la.add(lar1, lar2, join='outer')
label_0
a
b
c
dd
x
array([ 2., NaN, NaN, NaN])

An outer join with single and double missing values replaced by zero:

>>> la.add(lar1, lar2, join='outer', missone=0, misstwo=0)
label_0
a
b
c
dd
x
array([ 2., 2., 0., 0.])

Reply all
Reply to author
Forward
0 new messages