You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@symbolic_dispatchdefn(x):
"""Return the total number of elements in the array (or rows in a DataFrame). Example: >>> ser = pd.Series([1,2,3]) >>> n(ser) 3 >>> df = pd.DataFrame({'x': ser}) >>> n(df) 3 """ifisinstance(x, pd.DataFrame):
returnx.shape[0]
returnlen(x)
Could add a singledispatch for a SeriesGroupBy...
from siuba.experimental.pd_groups.groups import GroupByAgg
@n.register(SeriesGroupBy)
def _n_gser(x):
return GroupByAgg.from_result(.x.size(), x)
This is a pretty cumbersome example, and it doesn't follow the dependency inversion principal, but could if vector functions were abstracted from their pandas implementations, similar to #141.
The text was updated successfully, but these errors were encountered:
E.g. take the
n
function...Could add a singledispatch for a SeriesGroupBy...
This is a pretty cumbersome example, and it doesn't follow the dependency inversion principal, but could if vector functions were abstracted from their pandas implementations, similar to #141.
The text was updated successfully, but these errors were encountered: