Revision: 7920
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7920&view=rev
Author: jdh2358
Date: 2009-11-03 16:00:13 +0000 (Tue, 03 Nov 2009)
Log Message:
-----------
support postfixes in recs_join
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2009-11-03 15:46:14 UTC (rev
7919)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2009-11-03 16:00:13 UTC (rev
7920)
@@ -1893,7 +1893,7 @@
return newrec
-def recs_join(key, name, recs, jointype='outer', missing=0.):
+def recs_join(key, name, recs, jointype='outer', missing=0., postfixes=None):
"""
Join a sequence of record arrays on single column key.
@@ -1911,11 +1911,15 @@
*jointype*
is a string 'inner' or 'outer'
- *missing"
+ *missing*
is what any missing field is replaced by
+ *postfixes*
+ if not None, a len recs sequence of postfixes
- returns a record array with columns [rowkey, name1, name2, ... namen].
+ returns a record array with columns [rowkey, name0, name1, ... namen-1].
+ or if postfixes [PF0, PF1, ..., PFN-1] are supplied,
+ [rowkey, namePF0, namePF1, ... namePFN-1].
Example::
@@ -1938,7 +1942,9 @@
if None not in row: # throw out any Nones
results.append([rowkey] + map(extract, row))
- names = ",".join([key] + ["%s%d" % (name, d) for d in range(len(recs))])
+ if postfixes is None:
+ postfixes = ['%d'%i for i in range(len(recs))]
+ names = ",".join([key] + ["%s%s" % (name, postfix) for postfix in
postfixes])
return np.rec.fromrecords(results, names=names)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins