From ba7ba0b09ea6240e5cf7619cb1aa47acbcc3aff5 Mon Sep 17 00:00:00 2001 From: Naren Krishna <92325366+naren-ponder@users.noreply.github.com> Date: Wed, 25 Jan 2023 15:42:41 -0800 Subject: [PATCH] Fix nlargest and nsmallest Series support (#46) (core) Signed-off-by: Naren Krishna --- modin/pandas/series.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modin/pandas/series.py b/modin/pandas/series.py index c383f5dbe51..0573a45ae3f 100644 --- a/modin/pandas/series.py +++ b/modin/pandas/series.py @@ -1290,9 +1290,9 @@ def nlargest(self, n=5, keep="first"): # noqa: PR01, RT01, D200 raise NotImplementedError( "Series.nlargest is not implemented for empty Series." ) - return DataFrame( + return Series( query_compiler=self._query_compiler.nlargest( - n, [self._query_compiler.columns[0]], keep + n=n, columns=self.name, keep=keep ) ) @@ -1302,11 +1302,11 @@ def nsmallest(self, n=5, keep="first"): # noqa: PR01, RT01, D200 """ if len(self._query_compiler.columns) == 0: raise NotImplementedError( - "Series.nlargest is not implemented for empty Series." + "Series.nsmallest is not implemented for empty Series." ) - return DataFrame( + return Series( query_compiler=self._query_compiler.nsmallest( - n, [self._query_compiler.columns[0]], keep + n=n, columns=self.name, keep=keep ) )