datetimeindex resample issue · Issue #12348 · pandas-dev/pandas (original) (raw)

Hi- I am observing odd behavior when trying to use resample on an uneven datetimeindex. See the below code to reproduce:

import pandas as pd
import numpy as np

bug_datetimeindex = pd.date_range('2013-12-30', '2014-01-07')
bug_datetimeindex = bug_datetimeindex.drop([ \
pd.Timestamp('2014-01-01'), \
pd.Timestamp('2013-12-31'), \
pd.Timestamp('2014-01-04'), \
pd.Timestamp('2014-01-05')
])
temp_df = pd.DataFrame(index=bug_datetimeindex, data=np.random.randn(len(bug_datetimeindex), 2))
temp_df.resample('B')

throws up a ValueError: Length mismatch: Expected axis has 5 elements, new values have 7 elements

Using asfreq() does not throw up this error on my machine.

I am running pd 0.17.1 on Python 3.4.4. off Anaconda for Windows.