Skip to content

Commit

Permalink
default 0 for nth
Browse files Browse the repository at this point in the history
  • Loading branch information
samukweku committed Apr 11, 2023
1 parent f815321 commit d26226e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/core/expr/fexpr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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::oobj>(py::oint(0));
oobj skipna = args[1].to_oobj_or_none();
return nthFn.call({this, n, skipna});
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/expr/fexpr_nth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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::oobj>(py::oint(0));
auto skipna = args[2].to<bool>(false);
if (!n.is_int()) {
throw TypeError() << "The argument for the `nth` parameter "
Expand Down

0 comments on commit d26226e

Please sign in to comment.