-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
implement .dt accessor for Index classes #18429
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18429 +/- ##
==========================================
- Coverage 91.35% 91.33% -0.02%
==========================================
Files 163 163
Lines 49714 49719 +5
==========================================
- Hits 45415 45410 -5
- Misses 4299 4309 +10
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #18429 +/- ##
==========================================
- Coverage 91.35% 91.33% -0.02%
==========================================
Files 163 163
Lines 49714 49719 +5
==========================================
- Hits 45415 45410 -5
- Misses 4299 4309 +10
Continue to review full report at Codecov.
|
Yes, I think so (and not only for tab completion). Doing |
OK. Would returning |
No, because that would return a Series, while the Eg we could add a switch to |
I had hoped to avoid introducing a new class, but that should be doable. There is a lot of machinery in indexes.datetimelike, some of which can probably be made useful. |
how is this any more complicated than for |
StringMethods has special handling for cases where it is derived from a Series vs Index. I can do something analogous in So let's nail down the specs before I implement anything else. It modifying indexes.accessors to behave analogously to StringMethods going to make everyone happy? |
I think these should all be consistent, so yes, not sure there should actually be that much complexity. |
closing as stale, if you want to work on this, pls ping. I think the idea of this PR is fine, but needs resolution |
index.dt
-->self
forDatetimeIndex
,TimedeltaIndex
,PeriodIndex
. RaisesAttributeError
for others (identical error toSeries.dt
).@jorisvandenbossche in the discussion in #17134 you had a concern about tab completion/namespacing. Is that a sticking point for you?
git diff upstream/master -u -- "*.py" | flake8 --diff