def test_pandas_grouped_frame_fast_not_implemented(notimpl_entry): from siuba.experimental.pd_groups.dialect import fast_mutate gdf = data[notimpl_entry['accessor']].groupby('g') # TODO: once reading from yaml, no need to repr str_expr = str(notimpl_entry['expr_frame']) call_expr = strip_symbolic(eval(str_expr, {'_': _})) with pytest.raises(NotImplementedError): res = fast_mutate(gdf, result=call_expr)
def test_pandas_grouped_frame_fast_not_implemented(notimpl_entry): from siuba.experimental.pd_groups.dialect import fast_mutate gdf = data[notimpl_entry['accessor']].groupby('g') # TODO: once reading from yaml, no need to repr str_expr = str(notimpl_entry['expr_frame']) call_expr = strip_symbolic(eval(str_expr, {'_': _})) if notimpl_entry['action']['status'] in [ "todo", "maydo", "wontdo" ] and notimpl_entry["is_property"]: pytest.xfail() with pytest.raises(NotImplementedError): res = fast_mutate(gdf, result=call_expr)
def test_pandas_grouped_frame_fast_mutate(entry): from siuba.experimental.pd_groups.dialect import fast_mutate, DataFrameGroupBy gdf = get_data(entry, DATA).groupby('g') # Execute mutate ---------------------------------------------------------- str_expr, call_expr = get_df_expr(entry) res = fast_mutate(gdf, result=call_expr) dst = mutate(gdf, result=call_expr) # TODO: apply mark to skip failing tests, rather than downcast # pandas grouped aggs, when not using cython, _try_cast back to original type # but since mutate uses apply, it doesn't :/. Currently only affects median func. dst_obj = dst.obj if str_expr == '_.x.median()': dst_obj['result'] = gdf._try_cast(dst_obj['result'], gdf.x.obj) assert isinstance(dst, DataFrameGroupBy) assert_frame_equal(res.obj, dst_obj)
def test_pandas_grouped_frame_fast_not_implemented(notimpl_entry): from siuba.experimental.pd_groups.dialect import fast_mutate gdf = data[notimpl_entry['accessor']].groupby('g') # TODO: once reading from yaml, no need to repr str_expr = str(notimpl_entry['expr_frame']) call_expr = strip_symbolic(eval(str_expr, {'_': _})) if notimpl_entry['action']['status'] in [ "todo", "maydo", "wontdo" ] and notimpl_entry["is_property"]: pytest.xfail() with pytest.warns(UserWarning): try: # not implemented functions are punted to apply, and # not guaranteed to work (e.g. many lengthen arrays, etc..) res = fast_mutate(gdf, result=call_expr) except: pass