Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 4bc7a7e

Browse files
andrewaikens87facebook-github-bot
authored andcommitted
Remove unused methods _nlargest and _nsmallest from icolumn, numerical_column_cpu, and dataframe_cpu (#415)
Summary: Pull Request resolved: #415 Removes unused private methods in icolumn.py bringing code coverage to 79.2%. Reviewed By: wenleix Differential Revision: D37503197 fbshipit-source-id: abbcc601a76100f9568b57a4d8b8f3b924eb1703
1 parent 0f1b40b commit 4bc7a7e

File tree

3 files changed

+0
-75
lines changed

3 files changed

+0
-75
lines changed

torcharrow/icolumn.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,34 +1420,6 @@ def _count(self):
14201420
"""Return number of non-NA/null observations pgf the column/frame"""
14211421
return len(self) - self.null_count
14221422

1423-
@trace
1424-
@expression
1425-
def _nlargest(
1426-
self,
1427-
n=5,
1428-
columns: ty.Optional[ty.List[str]] = None,
1429-
keep: ty.Literal["last", "first"] = "first",
1430-
):
1431-
"""Returns a new data of the *n* largest element."""
1432-
# keep="all" not supported
1433-
if columns is not None:
1434-
raise TypeError(
1435-
"computing n-largest on non-structured column can't have 'columns' parameter"
1436-
)
1437-
return self.sort(ascending=False).head(n)
1438-
1439-
@trace
1440-
@expression
1441-
def _nsmallest(self, n=5, columns: ty.Optional[ty.List[str]] = None, keep="first"):
1442-
"""Returns a new data of the *n* smallest element."""
1443-
# keep="all" not supported
1444-
if columns is not None:
1445-
raise TypeError(
1446-
"computing n-smallest on non-structured column can't have 'columns' parameter"
1447-
)
1448-
1449-
return self.sort(ascending=True).head(n)
1450-
14511423
@trace
14521424
@expression
14531425
def _nunique(self, drop_null=True):

torcharrow/velox_rt/dataframe_cpu.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -617,29 +617,6 @@ def func(tup):
617617
res._extend([None] * self.null_count)
618618
return res._finalize()
619619

620-
@trace
621-
@expression
622-
def _nlargest(
623-
self,
624-
n=5,
625-
columns: Optional[List[str]] = None,
626-
keep="first",
627-
):
628-
"""Returns a new dataframe of the *n* largest elements."""
629-
# Todo add keep arg
630-
return self.sort(by=columns, ascending=False).head(n)
631-
632-
@trace
633-
@expression
634-
def _nsmallest(
635-
self,
636-
n=5,
637-
columns: Optional[List[str]] = None,
638-
keep="first",
639-
):
640-
"""Returns a new dataframe of the *n* smallest elements."""
641-
return self.sort(by=columns, ascending=True).head(n)
642-
643620
# operators --------------------------------------------------------------
644621

645622
@expression

torcharrow/velox_rt/numerical_column_cpu.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -193,30 +193,6 @@ def sort(
193193

194194
return ColumnCpuMixin._from_velox(self.device, self.dtype, col, True)
195195

196-
@trace
197-
@expression
198-
def _nlargest(
199-
self,
200-
n=5,
201-
columns: Optional[List[str]] = None,
202-
keep="first",
203-
):
204-
if columns is not None:
205-
raise TypeError(
206-
"computing n-largest on numerical column can't have 'columns' parameter"
207-
)
208-
return self.sort(columns=None, ascending=False, na_position=keep).head(n)
209-
210-
@trace
211-
@expression
212-
def _nsmallest(self, n=5, columns: Optional[List[str]] = None, keep="first"):
213-
if columns is not None:
214-
raise TypeError(
215-
"computing n-smallest on numerical column can't have 'columns' parameter"
216-
)
217-
218-
return self.sort(columns=None, ascending=True, na_position=keep).head(n)
219-
220196
@trace
221197
@expression
222198
def _nunique(self, drop_null=True):

0 commit comments

Comments
 (0)