h2oai / datatable

A Python package for manipulating 2-dimensional tabular data structures
https://datatable.readthedocs.io
Mozilla Public License 2.0
1.81k stars 156 forks source link

Create Equivalent Methods for Existing Datatable Functions #2946

Open samukweku opened 3 years ago

samukweku commented 3 years ago

This is a follow-up from the discussion here on adding methods to FExpr.

The method chaining format would look like this DT[:, f[:].rowsum().sum()], which would be an equivalent for DT[:, dt.rowsum(dt.sum(f[:]))]

Methods:

samukweku commented 3 years ago

@st-pasha , @oleksiyskononenko If you would be kind to show me how to pull this off for one of the existing functions (e.g sum). I tried using the same idea as for len, since I was not changing any C++ code, but it did not reflect when I restarted the python console

st-pasha commented 3 years ago

Hi @samukweku -- please see PR #2949 which implements the sum function. Most of it is self-explanatory: tests, documentation, etc. Most of the changes to C++ are in lines 331-345 of "fexpr.cc".

samukweku commented 3 years ago

@st-pasha Thank you very much! I'll go through them tonight. Again, thank you!!

oleksiyskononenko commented 2 years ago

@samukweku Do you want to create a list of methods in this issue that we need to implement for the existing dt functions? So that we keep track as to what is implemented and what is left.

samukweku commented 2 years ago

@oleksiyskononenko we also need to make method chaining work on dt.expr as well; at the moment it does not work on dt.expr objects