From b15a7610a24fe3ef5ac6d484185d215c62da4911 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Thu, 10 Jun 2021 08:16:33 -0400 Subject: [PATCH] Validate 'how' in Cython --- python/cudf/cudf/_lib/round.pyx | 2 ++ python/cudf/cudf/core/series.py | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/_lib/round.pyx b/python/cudf/cudf/_lib/round.pyx index f38e2660b8a..823da40f45b 100644 --- a/python/cudf/cudf/_lib/round.pyx +++ b/python/cudf/cudf/_lib/round.pyx @@ -26,6 +26,8 @@ def round(Column input_col, int decimal_places=0, how="half_even"): ------- A Column with values rounded to the given number of decimal places """ + if how not in {"half_even", "half_up"}: + raise ValueError("'how' must be either 'half_even' or 'half_up'") cdef column_view input_col_view = input_col.view() cdef unique_ptr[column] c_result diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 035c6d18c27..cf08b16b7d6 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -4776,8 +4776,6 @@ def round(self, decimals=0, how="half_even"): 2 3.0 dtype: float64 """ - if how not in {"half_up", "half_even"}: - raise ValueError("'how' must be either 'half_even' or 'half_up'") return Series( self._column.round(decimals=decimals, how=how), name=self.name,