ENH: Added functionality in resample to resolve #10530
State: closed

closes #10530 

I'm not 100% sure that I implemented this per the documentation or that my tests are complete but I'd be glad to make any necessary changes.


Labels:
name: Bug
name: Timedelta
description: Timedelta data type
name: Resample
description: resample method

Comments:
@jreback — thanks!

@jreback — any comments on the updates?

@jreback: I've been working on this and managed to move the code to `_get_time_delta_bins` and get it passing tests. However, the addition of the code to the `_get_time_delta_bins` function causes a segmentation fault (:gasp:). I traced this specific segfault to Numpy's `multiarray` module, though looking through resources on the Numpy side of things didn't return anything helpful.  

Do you have any insights on this?

**Reproducibility Instructions**

```
In [1]: import pandas as pd

In [2]: import numpy as np

In [3]: np.__version__
Out[3]: '1.9.2'

In [4]: rng = pd.timedelta_range(start = '0s', periods = 25, freq = 's')                                                                                                             

In [5]: ts = pd.Series(np.random.randn(len(rng)), index = rng)

In [6]: with_base = ts.resample('2s', base = 5)
All good after if in _get_binner_for_resample
All good after grouping
All good after setting values in _resample_timestamps
python(45587,0x7fff79f72300) malloc: *** error for object 0x4000000000000000: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
/Users/safia/anaconda/bin/python.app: line 3: 45587 Abort trap: 6           /Users/safia/anaconda/python.app/Contents/MacOS/python "$@"
```

And the crash report:

```
Process:               python [45587]
Path:                  /Users/USER/*/python.app/Contents/MacOS/python
Identifier:            python
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        bash [45586]
Responsible:           Terminal [1158]
User ID:               501

Date/Time:             2015-07-27 21:53:18.854 -0700
OS Version:            Mac OS X 10.90 (14A389)
Report Version:        11
Anonymous UUID:        DF1BBB33-4990-2AE4-9F20-0908197EB0E8

Sleep/Wake UUID:       49651817-F061-435F-AEF2-1606CDE5746E

Time Awake Since Boot: 41000 seconds
Time Since Wake:       10000 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called
*** error for object 0x4000000000000000: pointer being freed was not allocated


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8feb1282 __pthread_kill + 10
1   libsystem_c.dylib               0x00007fff8b292b73 abort + 129
2   libsystem_malloc.dylib          0x00007fff934ef937 free + 428
3   multiarray.so                   0x0000000103ab081e _buffer_clear_info + 110
4   multiarray.so                   0x0000000103ab079a _array_dealloc_buffer_info + 74
5   multiarray.so                   0x0000000103a8c3f2 array_dealloc + 18
6   algos.so                        0x00000001049c0022 __pyx_pw_6pandas_5algos_417group_mean_bin_float64 + 4058 (algos.c:130491)
7   libpython2.7.dylib              0x00000001000c39bd PyEval_EvalFrameEx + 24989
8   libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
9   libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
10  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
11  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
12  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
13  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
14  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
15  libpython2.7.dylib              0x000000010003e1d0 function_call + 176
16  libpython2.7.dylib              0x000000010000c7b2 PyObject_Call + 98
17  libpython2.7.dylib              0x00000001000bea0a PyEval_EvalFrameEx + 4586
18  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
19  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
20  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
21  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
22  libpython2.7.dylib              0x00000001000c505b PyEval_EvalFrameEx + 30779
23  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
24  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
25  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
26  libpython2.7.dylib              0x00000001000c5275 PyEval_EvalFrameEx + 31317
27  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
28  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
29  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
30  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
31  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
32  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
33  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
34  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
35  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
36  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
37  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
38  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
39  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
40  libpython2.7.dylib              0x000000010003e1d0 function_call + 176
41  libpython2.7.dylib              0x000000010000c7b2 PyObject_Call + 98
42  libpython2.7.dylib              0x00000001000bea0a PyEval_EvalFrameEx + 4586
43  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
44  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
45  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
46  libpython2.7.dylib              0x00000001000c5dc6 PyEval_EvalCode + 54
47  libpython2.7.dylib              0x00000001000eb17e PyRun_FileExFlags + 174
48  libpython2.7.dylib              0x00000001000eb41a PyRun_SimpleFileExFlags + 458
49  libpython2.7.dylib              0x000000010010248d Py_Main + 3165
50  com.continuum.python            0x0000000100000f54 start + 52

Thread 1:
0   libsystem_kernel.dylib          0x00007fff8feb1132 __psynch_cvwait + 10
1   libpython2.7.dylib              0x00000001000ff7b4 PyThread_acquire_lock + 116
2   libpython2.7.dylib              0x0000000100104295 lock_PyThread_acquire_lock + 69
3   libpython2.7.dylib              0x00000001000c39bd PyEval_EvalFrameEx + 24989
4   libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
5   libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
6   libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
7   libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
8   libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
9   libpython2.7.dylib              0x000000010003e1d0 function_call + 176
10  libpython2.7.dylib              0x000000010000c7b2 PyObject_Call + 98
11  libpython2.7.dylib              0x00000001000bea0a PyEval_EvalFrameEx + 4586
12  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
13  libpython2.7.dylib              0x00000001000c3d10 PyEval_EvalFrameEx + 25840
14  libpython2.7.dylib              0x00000001000c505b PyEval_EvalFrameEx + 30779
15  libpython2.7.dylib              0x00000001000c505b PyEval_EvalFrameEx + 30779
16  libpython2.7.dylib              0x00000001000c5ca3 PyEval_EvalCodeEx + 2115
17  libpython2.7.dylib              0x000000010003e1d0 function_call + 176
18  libpython2.7.dylib              0x000000010000c7b2 PyObject_Call + 98
19  libpython2.7.dylib              0x000000010001dccd instancemethod_call + 333
20  libpython2.7.dylib              0x000000010000c7b2 PyObject_Call + 98
21  libpython2.7.dylib              0x00000001000bc567 PyEval_CallObjectWithKeywords + 87
22  libpython2.7.dylib              0x00000001001047a7 t_bootstrap + 71
23  libsystem_pthread.dylib         0x00007fff8f7272fc _pthread_body + 131
24  libsystem_pthread.dylib         0x00007fff8f727279 _pthread_start + 176
25  libsystem_pthread.dylib         0x00007fff8f7254b1 thread_start + 13

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8feb1132 __psynch_cvwait + 10
1   interpreter.so                  0x00000001052a707b th_worker(void*) + 171
2   libsystem_pthread.dylib         0x00007fff8f7272fc _pthread_body + 131
3   libsystem_pthread.dylib         0x00007fff8f727279 _pthread_start + 176
4   libsystem_pthread.dylib         0x00007fff8f7254b1 thread_start + 13

Thread 3:
0   libsystem_kernel.dylib          0x00007fff8feb1132 __psynch_cvwait + 10
1   interpreter.so                  0x00000001052a707b th_worker(void*) + 171
2   libsystem_pthread.dylib         0x00007fff8f7272fc _pthread_body + 131
3   libsystem_pthread.dylib         0x00007fff8f727279 _pthread_start + 176
4   libsystem_pthread.dylib         0x00007fff8f7254b1 thread_start + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fff8feb1132 __psynch_cvwait + 10
1   interpreter.so                  0x00000001052a707b th_worker(void*) + 171
2   libsystem_pthread.dylib         0x00007fff8f7272fc _pthread_body + 131
3   libsystem_pthread.dylib         0x00007fff8f727279 _pthread_start + 176
4   libsystem_pthread.dylib         0x00007fff8f7254b1 thread_start + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fff8feb1132 __psynch_cvwait + 10
1   interpreter.so                  0x00000001052a707b th_worker(void*) + 171
2   libsystem_pthread.dylib         0x00007fff8f7272fc _pthread_body + 131
3   libsystem_pthread.dylib         0x00007fff8f727279 _pthread_start + 176
4   libsystem_pthread.dylib         0x00007fff8f7254b1 thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x0000000000000006  rcx: 0x00007fff5fbfb648  rdx: 0x0000000000000000
  rdi: 0x0000000000000513  rsi: 0x0000000000000006  rbp: 0x00007fff5fbfb670  rsp: 0x00007fff5fbfb648
   r8: 0x0000000000000001   r9: 0x0000000000000000  r10: 0x0000000008000000  r11: 0x0000000000000206
  r12: 0x000000010564e230  r13: 0x0000000000000001  r14: 0x00007fff79f72300  r15: 0x0000000000000000
  rip: 0x00007fff8feb1282  rfl: 0x0000000000000206  cr2: 0x00007fff7975ffd8

Logical CPU:     0
Error Code:      0x02000148
Trap Number:     133


Binary Images:
       0x100000000 -        0x100000ff7 +com.continuum.python (???) <BFEBEE5F-388C-AA34-D6A7-89C2685B5271> /Users/USER/*/python.app/Contents/MacOS/python
       0x100003000 -        0x100168ff3 +libpython2.7.dylib (2.7) <9FC353D3-C359-264F-E3D8-67C5F0FCE7FD> /Users/USER/*/libpython2.7.dylib
       0x1002ed000 -        0x1002efff7 +_locale.so (???) <FDE930CD-89E5-C3F6-A199-8D02CDD2C910> /Users/USER/*/_locale.so
       0x1002f3000 -        0x1002f7fff +_struct.so (???) <1F5B3CB4-57FD-8018-05E8-DBBCC283E1D1> /Users/USER/*/_struct.so
       0x1007f0000 -        0x1007f6fff +_json.so (???) <FE922887-EBF0-2465-29AA-D9A308FB8E47> /Users/USER/*/_json.so
       0x1007fb000 -        0x1007fcff7 +_heapq.so (???) <081C8296-142B-7E34-1939-275C1861BFB9> /Users/USER/*/_heapq.so
       0x102840000 -        0x102842ff7 +time.so (???) <25DC7D59-C19C-01DE-F990-02E1E19135E6> /Users/USER/*/time.so
       0x102847000 -        0x102848ff7 +cStringIO.so (???) <931D41F1-A896-1CFF-E047-1D7CAF37D6DE> /Users/USER/*/cStringIO.so
       0x10284d000 -        0x102851ff7 +_collections.so (???) <BEDA6E53-062E-06CE-F529-15CF8F934703> /Users/USER/*/_collections.so
       0x102897000 -        0x10289bff7 +operator.so (???) <F229EA1E-E021-B1E8-CBA3-B7C6BAB5FA94> /Users/USER/*/operator.so
       0x1028a2000 -        0x1028a9ff7 +itertools.so (???) <8B4BC4C2-EB50-ED9F-9487-8D0FFDC3E4EF> /Users/USER/*/itertools.so
       0x1028f4000 -        0x1028f7fff +strop.so (???) <12B0B50A-AAE0-4652-17C0-9797C6A9E2D6> /Users/USER/*/strop.so
       0x10293c000 -        0x10293dfff +_functools.so (???) <5D79465F-5646-7FE4-7AF7-08C02C123151> /Users/USER/*/_functools.so
       0x102a80000 -        0x102a80ff7 +grp.so (???) <D6EA7962-DBC7-3867-3807-D918B9E73876> /Users/USER/*/grp.so
       0x102a83000 -        0x102a88ff7 +math.so (???) <74C026FD-F881-9B02-681C-425310260885> /Users/USER/*/math.so
       0x102a8f000 -        0x102a91ff7 +binascii.so (???) <D79B15DD-70B2-32A6-967A-46AA7493513F> /Users/USER/*/binascii.so
       0x102a95000 -        0x102ab3fff +libz.1.2.8.dylib (1.2.8) <C26DB587-95D3-3EF3-818A-6B08081BE2CE> /Users/USER/*/libz.1.2.8.dylib
       0x102ab7000 -        0x102ab9ff7 +_hashlib.so (???) <BA699A7F-82C6-30E8-4E4D-3B67F7FF2042> /Users/USER/*/_hashlib.so
       0x102abd000 -        0x102b12fef +libssl.1.0.0.dylib (1) <7CABB30A-BCD8-DC2F-E9A9-60C716441AF5> /Users/USER/*/libssl.1.0.0.dylib
       0x102b30000 -        0x102c92fff +libcrypto.1.0.0.dylib (1) <60A2348C-E6AB-AF91-AA19-8BA30B82F1F5> /Users/USER/*/libcrypto.1.0.0.dylib
       0x102d03000 -        0x102d04ff7 +_random.so (???) <D3C2358B-CA40-67D0-4F10-CF0D73573800> /Users/USER/*/_random.so
       0x102d07000 -        0x102d1cfff +_io.so (???) <16E7468F-CB05-F642-D297-78A663A9BFAD> /Users/USER/*/_io.so
       0x102d33000 -        0x102d34ff7 +fcntl.so (???) <1EF544FB-D4E8-5F53-5608-BB570BDD2CC5> /Users/USER/*/fcntl.so
       0x102d77000 -        0x102d7afff +select.so (???) <4861D753-62C0-EF0F-E488-0F498FF78F28> /Users/USER/*/select.so
       0x102d80000 -        0x102d81fff +resource.so (???) <4EFDB3FE-E352-A6CE-780C-2C7EFE923ECF> /Users/USER/*/resource.so
       0x102d84000 -        0x102d85ff7 +termios.so (???) <E596F1A4-A465-32B8-7C7A-FF4C541C5302> /Users/USER/*/termios.so
       0x102f4a000 -        0x102f53ff7 +_socket.so (???) <F57B909D-4ECA-A017-D539-2A660394009E> /Users/USER/*/_socket.so
       0x102f5f000 -        0x102f6bff7 +_ssl.so (???) <1B538E14-EE66-7893-5DFB-44908BA06BBA> /Users/USER/*/_ssl.so
       0x102fb7000 -        0x102fb7ff7 +_scproxy.so (???) <03C6CCB8-D85F-03D0-AF11-C0702B1D18FF> /Users/USER/*/_scproxy.so
       0x102fba000 -        0x102fc8fff +datetime.so (???) <CE143D55-33CD-5250-A8FE-10728961A36D> /Users/USER/*/datetime.so
       0x103094000 -        0x10309ffff +_sqlite3.so (???) <A423B75A-BA9C-4F95-A37F-619361E7268C> /Users/USER/*/_sqlite3.so
       0x1030ab000 -        0x103180fef +libsqlite3.0.dylib (9.6) <86E65EA8-7790-0175-D40F-4A4A67F3AE82> /Users/USER/*/libsqlite3.0.dylib
       0x1031dd000 -        0x1031edfff +cPickle.so (???) <EEC565A7-DF9D-9DD6-538C-52A3ADE294EA> /Users/USER/*/cPickle.so
       0x103275000 -        0x103277ff7 +_lsprof.so (???) <C647D1F0-DE55-1CCA-8220-E98FFC7C8DEC> /Users/USER/*/_lsprof.so
       0x1032fb000 -        0x1032fcfff +lapack_lite.so (???) <21919A49-1600-3C7C-9773-5CBD9B6B0EDA> /Users/USER/*/lapack_lite.so
       0x103400000 -        0x103416ff7 +_ctypes.so (???) <83CB24C6-51B6-A1EB-FB97-04DE132C769C> /Users/USER/*/_ctypes.so
       0x1034a7000 -        0x1034aafff +zlib.so (???) <1E9501B4-FEA9-5922-934E-D3F5F3F4CEDB> /Users/USER/*/zlib.so
       0x1038f2000 -        0x1038f4fff +readline.so (???) <BDBCEECB-2A62-F611-71D9-33D321C2BB21> /Users/USER/*/readline.so
       0x1038fa000 -        0x103936ff7 +libreadline.6.2.dylib (6.2) <B96C0F47-77A4-3618-AD8F-3BCA5DCC5AFB> /Users/USER/*/libreadline.6.2.dylib
       0x10394c000 -        0x10399ffe7 +libncurses.5.dylib (5) <5A9A5756-DF8E-39D5-A1FD-F0F7D12756F7> /Users/USER/*/libncurses.5.dylib
       0x103a2e000 -        0x103a6afff +hashtable.so (0) <41FCE0EE-FFC8-3FE0-9AF7-3311F9C3FA7A> /Users/USER/*/hashtable.so
       0x103a88000 -        0x103ba5fff +multiarray.so (???) <3FA6B7C4-712F-39EE-8151-B0FA8AA29060> /Users/USER/*/multiarray.so
       0x103c62000 -        0x103cb8fff +umath.so (???) <65DFA61C-D764-3CA5-BA1C-1937CCBA6C0E> /Users/USER/*/umath.so
       0x103d24000 -        0x103d28ff7 +_dotblas.so (???) <AE555EE9-6A95-3C02-BE0D-225F70B1EDB0> /Users/USER/*/_dotblas.so
       0x103d6c000 -        0x103d8dff7 +scalarmath.so (???) <8292C021-F67E-3FAB-A148-954583036FFB> /Users/USER/*/scalarmath.so
       0x103e1f000 -        0x103e23ff7 +_compiled_base.so (???) <E2CC4F9B-D5D4-3BDC-9563-D19758A248EC> /Users/USER/*/_compiled_base.so
       0x103e67000 -        0x103e76fff +_umath_linalg.so (???) <BA3D399C-335C-3F03-A433-A6424F32DE96> /Users/USER/*/_umath_linalg.so
       0x103e82000 -        0x103e82fff +future_builtins.so (???) <B2ABFC56-4A16-B270-53CE-39F5D8D27523> /Users/USER/*/future_builtins.so
       0x103ec5000 -        0x103ecdfff +fftpack_lite.so (???) <B3C1C673-B6E9-3E73-A2F5-1CD006702344> /Users/USER/*/fftpack_lite.so
       0x103f11000 -        0x103f5fff7 +mtrand.so (???) <7BB8778C-FDAC-339C-8A2D-930685677EDD> /Users/USER/*/mtrand.so
       0x10402e000 -        0x10412fff7 +tslib.so (0) <4338FAD3-EB51-3A25-AC9A-66728228F00D> /Users/USER/*/tslib.so
       0x104213000 -        0x104218fff +array.so (???) <ED445376-9750-F14B-1F89-9A169A688F9E> /Users/USER/*/array.so
       0x10461f000 -        0x10462bfff +parser.so (???) <F07C8F39-46A4-0791-2418-8F4A281D57CC> /Users/USER/*/parser.so
       0x104631000 -        0x104665feb +pyexpat.so (???) <86713AAD-1394-620D-3377-5EF7941B9F7C> /Users/USER/*/pyexpat.so
       0x104677000 -        0x104677ff7 +_bisect.so (???) <B6706966-6DA4-96EC-9433-18F9F2460BAA> /Users/USER/*/_bisect.so
       0x10467a000 -        0x10467dfff +_csv.so (???) <A2600D77-EAF3-6244-9DAA-736945F1550C> /Users/USER/*/_csv.so
       0x104683000 -        0x1046b4fff +reduce.so (???) <4F637E38-64A6-3AB7-B861-0CD6C9D94AC3> /Users/USER/*/reduce.so
       0x1046cc000 -        0x1046d0fff +nonreduce.so (???) <D4FA5D9D-ECF7-3310-8A5A-B748EE555820> /Users/USER/*/nonreduce.so
       0x1046d7000 -        0x1046e8ff7 +nonreduce_axis.so (???) <27A11102-859D-30F0-8F4F-15C29259B333> /Users/USER/*/nonreduce_axis.so
       0x104800000 -        0x1048baff7 +lib.so (0) <BA494313-6979-3E73-94B7-F45A0B086D0F> /Users/USER/*/lib.so
       0x104907000 -        0x104b1afff +algos.so (0) <249B2A8C-E66C-3DEB-8C43-E672698D0339> /Users/USER/*/algos.so
       0x104e8c000 -        0x104ea2ff7 +move.so (???) <8DE9F54C-A636-377A-BAF4-A0E6C5983083> /Users/USER/*/move.so
       0x104eb0000 -        0x104ed7ff7 +index.so (0) <7FE10EEB-CC80-34DD-A6D3-6A68D4F6E43A> /Users/USER/*/index.so
       0x104eec000 -        0x104f29fff +_period.so (0) <4B614F88-0B92-3924-B498-014AC1839B3B> /Users/USER/*/_period.so
       0x10510a000 -        0x10513dff7 +_sparse.so (0) <91A73E6E-FD19-3DD0-AAB2-162AA0DA4F88> /Users/USER/*/_sparse.so
       0x105291000 -        0x1052adfff +interpreter.so (???) <A00762AF-41B3-3476-87BB-46A3BDAC8EA1> /Users/USER/*/interpreter.so
       0x1055e4000 -        0x1055f0fff +json.so (0) <CB2A5DD3-4655-3CFA-B35A-62CEEE7B5DD7> /Users/USER/*/json.so
       0x105940000 -        0x105980ff7 +_path.so (???) <9C4ED4B9-E116-EF7E-95E0-640F1BF1F601> /Users/USER/*/_path.so
       0x105b26000 -        0x105b70fff +parser.so (0) <1CF3D4C9-B246-3ECD-9F2E-00BA9AE8EE90> /Users/USER/*/parser.so
       0x105c51000 -        0x105c64fff +msgpack.so (0) <C6D2F000-AF28-39E5-B431-EBC9DA6C7D41> /Users/USER/*/msgpack.so
       0x105cb7000 -        0x105cbeff7 +_testing.so (0) <E0F99612-9306-3EC5-9EBB-8BA0B7677CBB> /Users/USER/*/_testing.so
    0x7fff60033000 -     0x7fff60069837  dyld (353.2.1) <4696A982-1500-34EC-9777-1EF7A03E2659> /usr/lib/dyld
    0x7fff89661000 -     0x7fff89663ff7  libsystem_sandbox.dylib (358.1.1) <DB9962EF-8898-31CC-9B87-E01F8CE74C9D> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff89664000 -     0x7fff896dcff7  com.apple.SystemConfiguration (1.14 - 1.14) <C269BCFD-ACAB-3331-BC7C-0430F0E84817> /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
    0x7fff896dd000 -     0x7fff896defff  libsystem_secinit.dylib (18) <581DAD0F-6B63-3A48-B63B-917AF799ABAA> /usr/lib/system/libsystem_secinit.dylib
    0x7fff89e32000 -     0x7fff8a1c8fff  com.apple.CoreFoundation (6.9 - 1151.16) <F2B088AF-A5C6-3FAE-9EB4-7931AF6359E4> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff8ad79000 -     0x7fff8ad90ff7  libLinearAlgebra.dylib (1128) <E78CCBAA-A999-3B65-8EC9-06DB15E67C37> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
    0x7fff8affd000 -     0x7fff8affeff7  libsystem_blocks.dylib (65) <9615D10A-FCA7-3BE4-AA1A-1B195DACE1A1> /usr/lib/system/libsystem_blocks.dylib
    0x7fff8b235000 -     0x7fff8b2c1fff  libsystem_c.dylib (1044.1.2) <C185E862-7424-3210-B528-6B822577A4B8> /usr/lib/system/libsystem_c.dylib
    0x7fff8b7f9000 -     0x7fff8bc4cfc7  com.apple.vImage (8.0 - 8.0) <33BE7B31-72DB-3364-B37E-C322A32748C5> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
    0x7fff8bc4d000 -     0x7fff8bc9cff7  libstdc++.6.dylib (104.1) <803F6AC8-87DC-3E24-9E80-729B551F6FFF> /usr/lib/libstdc++.6.dylib
    0x7fff8cc37000 -     0x7fff8ce1c267  libobjc.A.dylib (646) <3B60CD90-74A2-3A5D-9686-B0772159792A> /usr/lib/libobjc.A.dylib
    0x7fff8d43e000 -     0x7fff8d442fff  libcache.dylib (69) <45E9A2E7-99C4-36B2-BEE3-0C4E11614AD1> /usr/lib/system/libcache.dylib
    0x7fff8d691000 -     0x7fff8d6bbff7  libdispatch.dylib (442.1.4) <502CF32B-669B-3709-8862-08188225E4F0> /usr/lib/system/libdispatch.dylib
    0x7fff8d764000 -     0x7fff8d767ff7  libdyld.dylib (353.2.1) <19FAF435-C165-3374-9DEF-D7BBA7D61DB6> /usr/lib/system/libdyld.dylib
    0x7fff8d768000 -     0x7fff8d82bff7  libvMisc.dylib (512) <A4E39464-52EA-34CB-9FFE-53E79B3C65F5> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
    0x7fff8d83b000 -     0x7fff8d86bff7  libncurses.5.4.dylib (44) <F09809A4-53B9-3E91-A8FA-D3F584C03AA3> /usr/lib/libncurses.5.4.dylib
    0x7fff8d873000 -     0x7fff8d87efff  libcommonCrypto.dylib (60061) <D381EBC6-69D8-31D3-8084-5A80A32CB748> /usr/lib/system/libcommonCrypto.dylib
    0x7fff8d996000 -     0x7fff8db24fff  libBLAS.dylib (1128) <497912C1-A98E-3281-BED7-E9C751552F61> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    0x7fff8db25000 -     0x7fff8db26ffb  libremovefile.dylib (35) <3485B5F4-6CE8-3C62-8DFD-8736ED6E8531> /usr/lib/system/libremovefile.dylib
    0x7fff8db86000 -     0x7fff8db8effb  libcopyfile.dylib (118.1.2) <0C68D3A6-ACDD-3EF3-991A-CC82C32AB836> /usr/lib/system/libcopyfile.dylib
    0x7fff8db9a000 -     0x7fff8dbc2fff  libxpc.dylib (559.1.22) <9437C02E-A07B-38C8-91CB-299FAA63083D> /usr/lib/system/libxpc.dylib
    0x7fff8e1a5000 -     0x7fff8e1a5ff7  libkeymgr.dylib (28) <77845842-DE70-3CC5-BD01-C3D14227CED5> /usr/lib/system/libkeymgr.dylib
    0x7fff8e1a6000 -     0x7fff8e1a7fff  libSystem.B.dylib (1213) <DA954461-EC6A-3DF0-8551-6FC810627627> /usr/lib/libSystem.B.dylib
    0x7fff8f724000 -     0x7fff8f72dfff  libsystem_pthread.dylib (105.1.4) <26B1897F-0CD3-30F3-B55A-37CB45062D73> /usr/lib/system/libsystem_pthread.dylib
    0x7fff8f849000 -     0x7fff8f84fff7  libsystem_networkextension.dylib (167.1.10) <29AB225B-D7FB-30ED-9600-65D44B9A9442> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff8f95b000 -     0x7fff8f9d1fe7  libcorecrypto.dylib (233.1.2) <E1789801-3985-3949-B736-6B3378873301> /usr/lib/system/libcorecrypto.dylib
    0x7fff8fe9b000 -     0x7fff8feb8fff  libsystem_kernel.dylib (2782.1.97) <93E0E0A9-75B6-3904-BB4E-4BC7C05F4B6B> /usr/lib/system/libsystem_kernel.dylib
    0x7fff90d46000 -     0x7fff90d5cff7  libsystem_asl.dylib (267) <F153AC5B-0542-356E-88C8-20A62CA704E2> /usr/lib/system/libsystem_asl.dylib
    0x7fff90fdc000 -     0x7fff90fdeff7  libquarantine.dylib (76) <DC041627-2D92-361C-BABF-A869A5C72293> /usr/lib/system/libquarantine.dylib
    0x7fff9132d000 -     0x7fff91334ff7  libcompiler_rt.dylib (35) <BF8FC133-EE10-3DA6-9B90-92039E28678F> /usr/lib/system/libcompiler_rt.dylib
    0x7fff91335000 -     0x7fff91360fff  libc++abi.dylib (125) <88A22A0F-87C6-3002-BFBA-AC0F2808B8B9> /usr/lib/libc++abi.dylib
    0x7fff91c59000 -     0x7fff91c59ff7  liblaunch.dylib (559.1.22) <8A988924-8BE7-35FE-BF7D-322E90EFE49E> /usr/lib/system/liblaunch.dylib
    0x7fff91e64000 -     0x7fff91e6cfff  libsystem_dnssd.dylib (561.1.1) <62B70ECA-E40D-3C63-896E-7F00EC386DDB> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff926cf000 -     0x7fff926d0fff  libDiagnosticMessagesClient.dylib (100) <2EE8E436-5CDC-34C5-9959-5BA218D507FB> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff92a53000 -     0x7fff92b6afe7  libvDSP.dylib (512) <52777555-F051-3BC2-A2D2-9645907E836D> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
    0x7fff934eb000 -     0x7fff93507ff7  libsystem_malloc.dylib (53.1.1) <19BCC257-5717-3502-A71F-95D65AFA861B> /usr/lib/system/libsystem_malloc.dylib
    0x7fff9365c000 -     0x7fff936b0fff  libc++.1.dylib (120) <1B9530FD-989B-3174-BB1C-BDC159501710> /usr/lib/libc++.1.dylib
    0x7fff936b1000 -     0x7fff936e1fff  libsystem_m.dylib (3086.1) <1E12AB45-6D96-36D0-A226-F24D9FB0D9D6> /usr/lib/system/libsystem_m.dylib
    0x7fff93704000 -     0x7fff93709ff7  libmacho.dylib (862) <126CA2ED-DE91-308F-8881-B9DAEC3C63B6> /usr/lib/system/libmacho.dylib
    0x7fff94217000 -     0x7fff9424fffb  libsystem_network.dylib (411) <C0B2313D-47BE-38A9-BEE6-2634A4F5E14B> /usr/lib/system/libsystem_network.dylib
    0x7fff94ad4000 -     0x7fff94ad4ff7  libunc.dylib (29) <5676F7EA-C1DF-329F-B006-D2C3022B7D70> /usr/lib/system/libunc.dylib
    0x7fff94ad5000 -     0x7fff94addfff  libsystem_platform.dylib (63) <64E34079-D712-3D66-9CE2-418624A5C040> /usr/lib/system/libsystem_platform.dylib
    0x7fff94b35000 -     0x7fff94d1aff3  libicucore.A.dylib (531.30) <EF0E7544-E317-3550-A962-6AE65E78AF17> /usr/lib/libicucore.A.dylib
    0x7fff95399000 -     0x7fff9539eff7  libunwind.dylib (35.3) <BE7E51A0-B6EA-3A54-9CCA-9D88F683A6D6> /usr/lib/system/libunwind.dylib
    0x7fff953c7000 -     0x7fff953d7ff7  libbsm.0.dylib (34) <A3A2E56C-2B65-37C7-B43A-A1F926E1A0BB> /usr/lib/libbsm.0.dylib
    0x7fff95fca000 -     0x7fff95fccfff  libsystem_configuration.dylib (699.1.5) <9FBA1CE4-97D0-347E-A443-93ED94512E92> /usr/lib/system/libsystem_configuration.dylib
    0x7fff96090000 -     0x7fff9649dff7  libLAPACK.dylib (1128) <F9201AE7-B031-36DB-BCF8-971E994EF7C1> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
    0x7fff9649e000 -     0x7fff964a2fff  libsystem_stats.dylib (163.1.4) <1DB04436-5974-3F16-86CC-5FF5F390339C> /usr/lib/system/libsystem_stats.dylib
    0x7fff96820000 -     0x7fff96826fff  libsystem_trace.dylib (72.1.3) <A9E6B7D8-C327-3742-AC54-86C94218B1DF> /usr/lib/system/libsystem_trace.dylib
    0x7fff96aa4000 -     0x7fff96aadff7  libsystem_notify.dylib (133.1.1) <61147800-F320-3DAA-850C-BADF33855F29> /usr/lib/system/libsystem_notify.dylib
    0x7fff96ab7000 -     0x7fff96ab7fff  com.apple.Accelerate (1.10 - Accelerate 1.10) <227E2491-1DDB-336F-BF83-773CECEC66F1> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
    0x7fff96b38000 -     0x7fff96b60fff  libsystem_info.dylib (459) <B85A85D5-8530-3A93-B0C3-4DEC41F79478> /usr/lib/system/libsystem_info.dylib
    0x7fff96e88000 -     0x7fff96eceff7  libauto.dylib (186) <A260789B-D4D8-316A-9490-254767B8A5F1> /usr/lib/libauto.dylib
    0x7fff9702e000 -     0x7fff97030ff7  libsystem_coreservices.dylib (9) <41B7C578-5A53-31C8-A96F-C73E030B0938> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff97054000 -     0x7fff97054fff  com.apple.Accelerate.vecLib (3.10 - vecLib 3.10) <A48738CA-5B6F-3D14-97E9-2BFDFC3DCC06> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
    0x7fff9880d000 -     0x7fff9881eff7  libsystem_coretls.dylib (35.1.2) <EBBF7EF6-80D8-3F8F-825C-B412BD6D22C0> /usr/lib/system/libsystem_coretls.dylib
    0x7fff98bc2000 -     0x7fff98bd3ff7  libz.1.dylib (55) <88C7C7DE-04B8-316F-8B74-ACD9F3DE1AA1> /usr/lib/libz.1.dylib
```

try this: https://github.com/jreback/pandas/commit/f593a22c2f8e3f161c868344d37d32fb41ada7a0

your test is not right though. it should be the same length as resampling w/o the base. It just shifts the labels.

@jreback: The documentation is a little vague on this and I haven't used `TimeDeltaIndex`s much specifically, but my thought process was that the `base` variable shifts just the origin of the index up to but not past the end of the original index. For example,

```
In [1]: import pandas as pd
In [2]: import numpy as np
In [3]: rng = pd.date_range('1/1/2000 00:00:00', '1/1/2000 02:00', freq='s') 
In [4]: ts = pd.Series(np.random.randn(len(rng)), index=rng)
In [5]: ts.resample("5min")
Out[6]: 
2000-01-01 00:00:00    0.013062
2000-01-01 00:05:00    0.139534
2000-01-01 00:10:00   -0.041256
2000-01-01 00:15:00    0.053652
2000-01-01 00:20:00   -0.001729
2000-01-01 00:25:00   -0.029746
2000-01-01 00:30:00    0.088576
2000-01-01 00:35:00    0.037251
2000-01-01 00:40:00    0.026843
2000-01-01 00:45:00    0.072279
2000-01-01 00:50:00   -0.027181
2000-01-01 00:55:00    0.000295
2000-01-01 01:00:00   -0.011841
2000-01-01 01:05:00    0.012241
2000-01-01 01:10:00    0.066539
2000-01-01 01:15:00   -0.084721
2000-01-01 01:20:00   -0.172637
2000-01-01 01:25:00    0.006850
2000-01-01 01:30:00    0.060185
2000-01-01 01:35:00   -0.025297
2000-01-01 01:40:00    0.076625
2000-01-01 01:45:00    0.052509
2000-01-01 01:50:00    0.052641
2000-01-01 01:55:00   -0.027289
2000-01-01 02:00:00    0.153006
Freq: 5T, dtype: float64

In [7]: ts.resample("5min", base = 2)
Out[7]: 
1999-12-31 23:57:00    0.024507
2000-01-01 00:02:00    0.051019
2000-01-01 00:07:00    0.097611
2000-01-01 00:12:00   -0.009624
2000-01-01 00:17:00    0.069433
2000-01-01 00:22:00   -0.038853
2000-01-01 00:27:00   -0.071469
2000-01-01 00:32:00    0.100760
2000-01-01 00:37:00    0.049147
2000-01-01 00:42:00    0.035064
2000-01-01 00:47:00    0.071487
2000-01-01 00:52:00   -0.017152
2000-01-01 00:57:00   -0.030361
2000-01-01 01:02:00   -0.034262
2000-01-01 01:07:00    0.093033
2000-01-01 01:12:00   -0.000299
2000-01-01 01:17:00   -0.100216
2000-01-01 01:22:00   -0.124684
2000-01-01 01:27:00   -0.023405
2000-01-01 01:32:00    0.068558
2000-01-01 01:37:00    0.028446
2000-01-01 01:42:00    0.049118
2000-01-01 01:47:00    0.035673
2000-01-01 01:52:00    0.047628
2000-01-01 01:57:00   -0.030767
Freq: 5T, dtype: float64

In [8]: ts.resample("5min", base = 8)
Out[8]: 
1999-12-31 23:58:00   -0.006227
2000-01-01 00:03:00    0.125830
2000-01-01 00:08:00    0.003593
2000-01-01 00:13:00    0.013914
2000-01-01 00:18:00    0.073193
2000-01-01 00:23:00   -0.054944
2000-01-01 00:28:00   -0.025494
2000-01-01 00:33:00    0.073621
2000-01-01 00:38:00    0.046354
2000-01-01 00:43:00    0.094799
2000-01-01 00:48:00    0.028624
2000-01-01 00:53:00   -0.041689
2000-01-01 00:58:00   -0.031873
2000-01-01 01:03:00   -0.017953
2000-01-01 01:08:00    0.100750
2000-01-01 01:13:00   -0.070052
2000-01-01 01:18:00   -0.090126
2000-01-01 01:23:00   -0.078358
2000-01-01 01:28:00    0.021255
2000-01-01 01:33:00   -0.005668
2000-01-01 01:38:00    0.054962
2000-01-01 01:43:00    0.074532
2000-01-01 01:48:00    0.022946
2000-01-01 01:53:00    0.004059
2000-01-01 01:58:00    0.047995
Freq: 5T, dtype: float64
```

An explanation would be much appreciated as I'm not so savvy with TimeDeltaIndex! :)

![49878803](https://cloud.githubusercontent.com/assets/1857993/8972826/83af9878-3612-11e5-82b9-73579dcf7adb.jpg)

base should work the same for any of the datetimelikes

it's just an add to every value 

it's not really s shift but it works the same way
so let's implement it by adding I think is easiest 
(FYI this is one of those oddball parameters - not even sure what a good use case is)

@jreback — Agreed. The documentation on it is pretty poor. Did another retrace of how `base` is applied on `DateTimeIndex` and it looks like [these lines](https://github.com/pydata/pandas/blob/master/pandas/tseries/resample.py#L422) have the desired affect. I'll take another look at it this weekend and submit the (what I hope will be last) pull request.

> (FYI this is one of those oddball parameters - not even sure what a good use case is)

I actually use `base` all the time with DatetimeIndex -- it's useful for doing resampling a time-series to daily values with the origin not at midnight (e.g., from noon to noon instead).

@jreback: Made updates. Updated the tests a bit so that functionality aligns with what happens when you `resample` with a `DatetimeIndex`. Let me know how it looks.

looks good

pls rebase on master and squash 

@jreback — squashed.

pls add a note in whatsnew 

That outta do it, @jreback — let me know if it needs anything else.

merged via https://github.com/pydata/pandas/commit/433602022bfbb9ee2424b77694c60f276065dee8

thanks!