Skip to content

Commit d26226e

Browse files
committed
default 0 for nth
1 parent f815321 commit d26226e

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/core/expr/fexpr.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,7 @@ DECLARE_METHOD(&PyFExpr::min)
533533

534534
oobj PyFExpr::nth(const XArgs& args) {
535535
auto nthFn = oobj::import("datatable", "nth");
536-
oobj n = args[0].to_oobj() ? args[0].to_oobj()
537-
: py::oint(0);
536+
auto n = args[1].to<py::oobj>(py::oint(0));
538537
oobj skipna = args[1].to_oobj_or_none();
539538
return nthFn.call({this, n, skipna});
540539
}

src/core/expr/fexpr_nth.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class FExpr_Nth : public FExpr_Func {
110110

111111
static py::oobj pyfn_nth(const py::XArgs& args) {
112112
auto arg = args[0].to_oobj();
113-
auto n = args[1].to_oobj();
113+
auto n = args[1].to<py::oobj>(py::oint(0));
114114
auto skipna = args[2].to<bool>(false);
115115
if (!n.is_int()) {
116116
throw TypeError() << "The argument for the `nth` parameter "

0 commit comments

Comments
 (0)