MCPcopy
hub / github.com/pandas-dev/pandas / test_unary_in_function

Method test_unary_in_function

pandas/tests/computation/test_eval.py:631–643  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

629 assert res.values == np.array([False])
630
631 def test_unary_in_function(self):
632 # GH 46471
633 df = DataFrame({"x": [0, 1, np.nan]})
634
635 result = df.eval("x.fillna(-1)")
636 expected = df.x.fillna(-1)
637 # column name becomes None if using numexpr
638 # only check names when the engine is not numexpr
639 tm.assert_series_equal(result, expected, check_names=not USE_NUMEXPR)
640
641 result = df.eval("x.shift(1, fill_value=-1)")
642 expected = df.x.shift(1, fill_value=-1)
643 tm.assert_series_equal(result, expected, check_names=not USE_NUMEXPR)
644
645 @pytest.mark.parametrize(
646 "ex",

Callers

nothing calls this directly

Calls 4

evalMethod · 0.95
DataFrameClass · 0.90
fillnaMethod · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected