From d26226ee3e51513ce3fc77af2f1aed3689946b47 Mon Sep 17 00:00:00 2001 From: samukweku Date: Sun, 12 Mar 2023 15:21:42 +1100 Subject: [PATCH] default 0 for nth --- src/core/expr/fexpr.cc | 3 +-- src/core/expr/fexpr_nth.cc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/expr/fexpr.cc b/src/core/expr/fexpr.cc index 8d5f95f46..8b6458c9b 100644 --- a/src/core/expr/fexpr.cc +++ b/src/core/expr/fexpr.cc @@ -533,8 +533,7 @@ DECLARE_METHOD(&PyFExpr::min) oobj PyFExpr::nth(const XArgs& args) { auto nthFn = oobj::import("datatable", "nth"); - oobj n = args[0].to_oobj() ? args[0].to_oobj() - : py::oint(0); + auto n = args[1].to(py::oint(0)); oobj skipna = args[1].to_oobj_or_none(); return nthFn.call({this, n, skipna}); } diff --git a/src/core/expr/fexpr_nth.cc b/src/core/expr/fexpr_nth.cc index aecde185d..7f98fac34 100644 --- a/src/core/expr/fexpr_nth.cc +++ b/src/core/expr/fexpr_nth.cc @@ -110,7 +110,7 @@ class FExpr_Nth : public FExpr_Func { static py::oobj pyfn_nth(const py::XArgs& args) { auto arg = args[0].to_oobj(); - auto n = args[1].to_oobj(); + auto n = args[1].to(py::oint(0)); auto skipna = args[2].to(false); if (!n.is_int()) { throw TypeError() << "The argument for the `nth` parameter "