API: Consider porting extension accessor from xarray · Issue #14781 · pandas-dev/pandas (original) (raw)

xarray provides a decorator to register a custom accessor on a Dataset - see docs here.

It's a bit of a blunt tool, in that it applies to all instances, but outside of that, I found it to be a nice alternative to subclassing or a composition class.

I haven't looked at the implementation, so not sure how hard it would be retrofit onto DataFrame

@shoyer - any thoughts or feedback from people using it?