cudf
cudf copied to clipboard
[FEA] Define unary operations like `__neg__`, `__pos__`, `__abs__` and `__invert__` for `Column`.
Currently, invoking Python's builtin unary operators on columns raises:
>>> s = cudf.Series([1, 2, 3])
>>> -s._column # TypeError
This came up in https://github.com/rapidsai/cudf/pull/10564.
A workaround is to do for example, s._column.unary_operator("abs") or 0 - s._column, but it would be nice to do this in a more Pythonic way.
Similar to how I've defined a mixin for binary operations, I plan to do the same for unary operations. At that point I also plan to apply that to columns so that we can define suitable operators there.
This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.
This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.