-
-
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
ENH: TimeDeltaIndex and corresponding scalar #3009
Comments
This would be totally awesome, especially for any kind of experimental data. |
there is already quite a lot of support, see the time delta section (in time series part of docs) |
ha! didn't realize i had seen this already |
For reference (as #7640) was not the appropriate place to share, here's a hacked implementation of datetime --> timeinterval. http://nbviewer.ipython.org/github/hugadams/pyuvvis/blob/master/examples/Notebooks/intervals.ipynb I'd imagine the TimeDeltaIndex should supplant the need for such an API entirely. |
Almost have this working.
I think I need something better for the repr, because unlike other formats, commas CAN be in a single element, so it gets confusing.
any thoughts @jorisvandenbossche @cpcloud @hayd @TomAugspurger |
@jreback Sweet! Is there a |
@shoyer just created a
|
API issue: should a mainly this is for the constructor. should it be as close to |
If you can get back from the string to the timedelta, then maybe stringify the repr to remove comma ambiguity:
+1 This looks great! |
I assume that the you will be able to query using any string that can be handled by RE: |
yep that's pretty easy a bit trickier (but not a lot) is partial string indexing eg s.loc['1 day':] is effectively >=1 day and < 2 days |
why wouldn't that be ">= 1 day"? |
For the repr, other option is to use |
@jreback How would both look like (what would be the differences) if Timedelta would more be like datetime.timedelta or np.timedelta64? And would a timedelta64 series element also return this? (like you now also get Timestamps from a datetime64 series)? |
So I created
only API change in this entire thing really is that Still need more tests / integration. |
PR is now #8184, further comments can go there |
(e.g. dt + dt, only dt - dt?) BUG/API: Fix operating with timedelta64/pd.offsets on rhs of a datelike series/index #4534
Timestamp (Timedelta?), direct wrapper might work, ENH: create Timedelta scalar / TimedeltaIndex #8184
that forwards methods, internally repr as timedelta64 (or view?) as array
see Weird Datetime Behaviour #3002 and ENH: support min/max on timedelta64[ns] Series #2990, ENH: timedelta should write correctly to csv #4378
read_csv to have aparse_timedelta
to automatically apply the dtype, see API: add parse_timedelta kw for read_csv #4650, ENH: GH3371 support timedelta fillna #4684, moved to ENH: read_csv to have a parse_timedelta kw to automatically parse into timedelta64 #8185The text was updated successfully, but these errors were encountered: