Skip to content

REF: use inherit_names for TimedeltaIndex #31427

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

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

jbrockmendel
Copy link
Member

ATM we have two separate ways of doing inheritance/pass-through for our EA-backed Indexes. This moves TDI over to all-inherit_names, Will do the same for other EA-Indexes in their own PRs.

@jorisvandenbossche
Copy link
Member

Can you explain a bit what's the difference between the two mechanisms? (the delegate_names vs inherit_names)

@jbrockmendel
Copy link
Member Author

Can you explain a bit what's the difference between the two mechanisms? (the delegate_names vs inherit_names)

  1. inherit_names has a kwarg that allows us to inherit a property as a cache_readonly
  2. inherit_names works for class attributes, i.e. not properties or methods
  3. inherit_names lets us to avoid repeating boilerplate of PandasDelegate

@jreback jreback added Clean Refactor Internal refactoring of code Timedelta Timedelta data type and removed Clean labels Jan 31, 2020
@jreback jreback added this to the 1.1 milestone Jan 31, 2020
@jreback jreback merged commit dac3ab8 into pandas-dev:master Jan 31, 2020
@jreback
Copy link
Contributor

jreback commented Jan 31, 2020

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-delegate5 branch January 31, 2020 04:19
@jorisvandenbossche
Copy link
Member

inherit_names works for class attributes, i.e. not properties or methods

What do you mean exactly? In this PR it's being used for methods? (eg sum, median, etc)

@jbrockmendel
Copy link
Member Author

What do you mean exactly? In this PR it's being used for methods? (eg sum, median, etc)

e.g. We use inherit names on DatetimeIndex to inherit _bool_ops, which is just a list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants