Skip to content

datetimeindex resample issue #12348

Closed
Closed
@JohnSmizz

Description

@JohnSmizz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions