Skip to content

_get_attributes_dict formalization #19249

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

Closed
jbrockmendel opened this issue Jan 15, 2018 · 3 comments
Closed

_get_attributes_dict formalization #19249

jbrockmendel opened this issue Jan 15, 2018 · 3 comments

Comments

@jbrockmendel
Copy link
Member

Index subclasses have a _get_attributes_dict method that would be useful to employ elsewhere (here I'm thinking of DateOffset subclasses and discussion in #19174). Could/should that be defined in a Mixin class (say in core.base) so that pattern could be documented and used elsewhere?

@jreback
Copy link
Contributor

jreback commented Jan 16, 2018

we do things this also for groupby/rolling as well. I suppose it could be moved to the pandas/core/base.py/PandasObject which already mixes everything (well except for offsets)

@jbrockmendel
Copy link
Member Author

Because offsets are perf-sensitive it might need to be implemented in cython. That aside, rolling it into PandasObject makes a lot of sense.

Block.make_block looks a lot like Index._shallow_copy. A bunch of the DatetimeIndexOpsMixin arithmetic/comparison (ones that I think @TomAugspurger agrees would go nicely in an Array-level class) use _shallow_copy. Making the Block classes conform to the IndexOps name conventions would make that refactor a lot easier.

@jreback
Copy link
Contributor

jreback commented Jan 19, 2018

not sure we need an issue for this. if you want to do it great. Not sure make_block and _shallow_copy make sense to be combined, they are different animals.

@jreback jreback closed this as completed Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants