 <p>Your lambda receives a numpy array, which does not have a <code>.rank</code> method &mdash; it is pandas's <code>Series</code> and <code>DataFrame</code> that have it. You can thus change it to</p> <pre><code>pctrank = lambda x: pd.Series(x).rank(pct=True).iloc[-1] </code></pre> <p>Or you could use pure numpy along the lines of <a href="http://stackoverflow.com/a/5284703/509824">this SO answer</a>:</p> <pre><code>def pctrank(x): n = len(x) temp = x.argsort() ranks = np.empty(n) ranks[temp] = (np.arange(n) + 1) / n return ranks[-1] </code></pre>