-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: Consider porting extension accessor from xarray #14781
Comments
This is pretty lightweight and self-contained -- would be easy to copy into pandas: https://github.com/pydata/xarray/blob/master/xarray/core/extensions.py The only change in the works is switching to warning instead of erroring when overriding a pre-existing attribute: pydata/xarray#1149 |
Following up on this instead of opening a new issue: are accessors considered user-facing? If so, is there a One True Way to put one together? The Related 1: are Related 2: Right now |
@jbrockmendel not sure what u are asking here |
No, the existing accessor machinery is not user facing, this issue was about potentially adding some that is. I would be supportive of adding something like the xarray extension decorators, so PR would be welcome if you're interested in implementing something like that. I think you could basically copy that implementation, most of the work would be docs and tests. |
Back-migrating question #16890
I communicated poorly by using The "wedge into _dir_deletions" comment referred more generally to items that aren't so easy to get rid of entirely, but may be namespace-clutter. This is not all that pertinent to the accessor topic. |
I think these are basically one-time use methods. We're been somewhat sloppy about adding lots of private methods in the past, but since IPython exposes them in tab-completition there is indeed some virtue to cleaning things up later. Better still might be making these functions instead, so they never pollute the namespace in the first place. |
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing pandas-dev#18767 outside of pandas. Closes pandas-dev#14781
* ENH: Added public accessor registrar Adds new methods for registing custom accessors to pandas objects. This will be helpful for implementing #18767 outside of pandas. Closes #14781 * PEP8 * Moved to extensions * More docs * Fix see also * DOC: Added whatsnew * Move to api * Update post review * flake8 * Raise the underlying error instead of a RuntimeError * str validate * DOC: Moved to developer * REF: Use public registrars for accessors * cleanup * Implemented optional caching * Document cache * Tests passing * Use for plot * Fix autodoc * Fix the class instantiation * Refactor again. 1. Removed optional caching 2. Refactored `Properties` to create the indexes it uses on demand 3. Moved accessor definitions to classes for clarity * Fix API files * Remove stale comment * Tests pass * DOC: some cleanup * No need to assign doc * Rename, shared docs * Doc __new__ * Use UserWarning * Update test
xarray
provides a decorator to register a custom accessor on aDataset
- 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?
The text was updated successfully, but these errors were encountered: