From f0700824d0cd5537ebe89c747dfb134914ba2d29 Mon Sep 17 00:00:00 2001 From: Roger Thomas Date: Thu, 30 Mar 2017 11:48:17 +0100 Subject: [PATCH] Use iloc instead of take --- pandas/core/algorithms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index d19bad4f37093c..023b360c5bb5c3 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -955,7 +955,7 @@ def select_n_frame(frame, columns, n, method, keep): inds = series.argsort()[::-1][:n] else: inds = series.argsort()[:n] - values = series.take(inds) + values = series.iloc[inds] if i != len(columns) - 1 and values.duplicated().any(): # This series has duplicate values => we must consider all rows in # frame that match `values`