Skip to content
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

Adding DataFrames with offsets yields naive index #500

craustin opened this issue Dec 16, 2011 · 2 comments


Copy link

commented Dec 16, 2011

Adding two DataFrames with a DateRange index (with BusinessMonthEnd offset) yields a DataFrame with a simple 'Index'.


This comment has been minimized.

Copy link

commented Dec 16, 2011

from pandas import DateRange, DataFrame
from pandas.core.datetools import BMonthEnd
a = DataFrame({}, index=DateRange('2011-01-01', '2011-11-30', offset=BMonthEnd()))
b = DataFrame({}, index=DateRange('2011-01-01', '2011-11-29', offset=BMonthEnd()))
print a+b

Empty DataFrame
Columns: Index([], dtype=object)
Index: Index([2011-01-31 00:00:00, 2011-02-28 00:00:00, 2011-03-31 00:00:00,
2011-04-29 00:00:00, 2011-05-31 00:00:00, 2011-06-30 00:00:00,
2011-07-29 00:00:00, 2011-08-31 00:00:00, 2011-09-30 00:00:00,
2011-10-31 00:00:00, 2011-11-30 00:00:00], dtype=object)

In Pandas 0.4.0, yields:
Empty DataFrame
class 'pandas.core.daterange.DateRange'
offset: 1 BusinessMonthEnd, tzinfo: None
[2011-01-31 00:00:00, ..., 2011-11-30 00:00:00]
length: 11

Note, this doesn't just happen with empty DataFrames - I just did that for a simple repro.

wesm added a commit that referenced this issue Dec 17, 2011

This comment has been minimized.

Copy link

commented Dec 17, 2011

Fixed in the above commit

@wesm wesm closed this Dec 17, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.