Skip to content

Commit ef731df

Browse files
committed
implemenation of isna fexpr
1 parent 74ed11e commit ef731df

File tree

6 files changed

+90
-7
lines changed

6 files changed

+90
-7
lines changed

src/core/expr/fexpr_isna.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ DECLARE_PYFN(&pyfn_isna)
6060
->n_required_args(1);
6161

6262

63-
}} // dt::expr
63+
}} // dt::expr

src/core/expr/fexpr_isna.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//------------------------------------------------------------------------------
2+
// Copyright 2022-2023 H2O.ai
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a
5+
// copy of this software and associated documentation files (the "Software"),
6+
// to deal in the Software without restriction, including without limitation
7+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
// and/or sell copies of the Software, and to permit persons to whom the
9+
// Software is furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
// IN THE SOFTWARE.
21+
//------------------------------------------------------------------------------
22+
<<<<<<<< HEAD:src/core/expr/fexpr_isna.cc
23+
#include "column/const.h"
24+
#include "column/isna.h"
25+
#include "expr/fexpr_column.h"
26+
#include "documentation.h"
27+
#include "expr/fexpr_func_unary.h"
28+
#include "expr/eval_context.h"
29+
#include "expr/workframe.h"
30+
#include "python/xargs.h"
31+
#include "stype.h"
32+
========
33+
#ifndef dt_EXPR_FEXPR_ISNA_h
34+
#define dt_EXPR_FEXPR_ISNA_h
35+
#include "expr/fexpr_func.h"
36+
>>>>>>>> da5f26d3 (implemenation of isna fexpr):src/core/expr/fexpr_isna.h
37+
namespace dt {
38+
namespace expr {
39+
40+
41+
<<<<<<<< HEAD:src/core/expr/fexpr_isna.cc
42+
class FExpr_ISNA : public FExpr_FuncUnary {
43+
public:
44+
using FExpr_FuncUnary::FExpr_FuncUnary;
45+
46+
47+
std::string name() const override {
48+
return "isna";
49+
}
50+
51+
Column evaluate1(Column&& col) const override{
52+
return make_isna_col(std::move(col));
53+
}
54+
};
55+
56+
57+
static py::oobj pyfn_isna(const py::XArgs &args) {
58+
auto isna = args[0].to_oobj();
59+
return PyFExpr::make(new FExpr_ISNA(as_fexpr(isna)));
60+
}
61+
62+
DECLARE_PYFN(&pyfn_isna)
63+
->name("isna")
64+
->docs(doc_dt_isna)
65+
->arg_names({"cols"})
66+
->n_positional_args(1)
67+
->n_required_args(1);
68+
69+
70+
}} // dt::expr
71+
========
72+
class FExpr_ISNA : public FExpr_Func {
73+
private:
74+
ptrExpr arg_;
75+
76+
public:
77+
FExpr_ISNA(ptrExpr&& arg);
78+
std::string repr() const override;
79+
Workframe evaluate_n(EvalContext& ctx) const override;
80+
};
81+
82+
83+
}} // dt::expr
84+
#endif
85+
>>>>>>>> da5f26d3 (implemenation of isna fexpr):src/core/expr/fexpr_isna.h

src/datatable/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
# IN THE SOFTWARE.
2222
#-------------------------------------------------------------------------------
2323
from .frame import Frame
24-
from .expr import (min, max, sd, sum, count, countna, first, abs, exp,
25-
last, log, log10, f, g, median, cov, corr, nunique)
24+
from .expr import (min, max, sd, sum, count, first, abs, exp,
25+
last, log, log10, f, g, median, cov, corr, countna, nunique)
2626
from .lib._datatable import (
2727
as_type,
2828
by,
@@ -123,7 +123,6 @@
123123
"int8",
124124
"intersect",
125125
"iread",
126-
"isna",
127126
"join",
128127
"last",
129128
"log",

src/datatable/expr/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# http://www.apache.org/licenses/LICENSE-2.0
1010
#
1111
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# distributed undesrc = [False, True, False, False, True]r the License is distributed on an "AS IS" BASIS,
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.

src/datatable/math.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
isclose,
4949
isfinite,
5050
isinf,
51-
isna,
5251
ldexp,
5352
lgamma,
5453
log,

tests/math/test-isna.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@pytest.mark.parametrize("src", all_sources)
4949
def test_isna(src):
5050
DT = dt.Frame(src)
51-
RES = DT[:, dt.isna(f[0])]
51+
RES = DT[:, dt.math.isna(f[0])]
5252
assert_equals(RES, dt.Frame([(x is None) for x in src]))
5353

5454

0 commit comments

Comments
 (0)